Skip to content

Commit 1e4d715

Browse files
committed
update xgolsw for getProperties api change
1 parent f9f6404 commit 1e4d715

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

spx-gui/src/components/editor/code-editor/spx-code-editor/ui/input-helper/SpxPropertyNameInput.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,14 @@ const codeEditor = useCodeEditor()
4141
4242
const properties = ref<Property[]>([])
4343
44-
async function getProperties(textDocument: TextDocument, signal?: AbortSignal) {
44+
function getProperties(textDocument: TextDocument, signal?: AbortSignal) {
4545
const codeFilePath = getCodeFilePath(textDocument.id.uri)
4646
const isStage = stageCodeFilePaths.includes(codeFilePath)
4747
if (isStage) {
48-
return await codeEditor.getProperties('', signal)
48+
return codeEditor.getProperties('', signal)
4949
}
5050
const spriteName = codeFilePath.replace(/\.spx$/, '')
51-
const [stageProperties, spriteProperties] = await Promise.all([
52-
codeEditor.getProperties('', signal),
53-
codeEditor.getProperties(spriteName, signal)
54-
])
55-
const spritePropertyNames = new Set(spriteProperties.map((p) => p.name))
56-
return [...spriteProperties, ...stageProperties.filter((p) => !spritePropertyNames.has(p.name))]
51+
return codeEditor.getProperties(spriteName, signal)
5752
}
5853
5954
watchEffect(async (onCleanup) => {

spx-gui/src/components/editor/code-editor/xgo-code-editor/code-editor.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
toLSPPosition,
2121
type TextDocumentIdentifier,
2222
type ResourceIdentifier,
23+
DefinitionKind,
2324
fromLSPTextEdit,
2425
type Position,
2526
getTextDocumentId,
@@ -335,7 +336,23 @@ export class CodeEditor extends Disposable {
335336

336337
/** Get properties for a given target */
337338
async getProperties(target: string, signal?: AbortSignal): Promise<Property[]> {
338-
return this.lspClient.getProperties({ signal }, target)
339+
const properties = await this.lspClient.getProperties({ signal }, target)
340+
341+
const classFrameworkPkg = this.project.classFramework.pkgPaths[0]
342+
const maybeProperties = await Promise.all(
343+
properties.map(async (item) => {
344+
const documentation = await this.documentBase.getDocumentation(item.definition)
345+
// Skip APIs from framework packages without documentation — assumed not recommended
346+
if (item.definition.package === classFrameworkPkg && documentation == null) return null
347+
if (documentation != null) {
348+
if (documentation.hiddenFromList) return null
349+
if (![DefinitionKind.Read, DefinitionKind.Variable, DefinitionKind.Constant].includes(documentation.kind))
350+
return null
351+
}
352+
return item
353+
})
354+
)
355+
return maybeProperties.filter((item) => item != null)
339356
}
340357

341358
private uis: ICodeEditorUIController[] = []

spx-gui/src/components/editor/code-editor/xgo-code-editor/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ export type Property = {
620620
kind: 'field' | 'method'
621621
/** Optional documentation for the property */
622622
doc?: string
623+
/** The definition identifier for the property */
624+
definition: DefinitionIdentifier
623625
}
624626

625627
export function positionEq(a: Position | null, b: Position | null) {

tools/spxls/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ tool github.com/goplus/xgolsw/cmd/pkgdatagen
66

77
require (
88
github.com/goplus/builder/tools/ai v0.0.0
9-
github.com/goplus/xgolsw v0.17.0
9+
github.com/goplus/xgolsw v0.17.1-0.20260327033750-feb54c4edc9e
1010
)
1111

1212
require (
1313
github.com/goplus/gogen v1.21.2 // indirect
1414
github.com/goplus/mod v0.19.6 // indirect
1515
github.com/goplus/spbase v0.1.0 // indirect
1616
github.com/goplus/spx/v2 v2.0.0-pre.48 // indirect
17-
github.com/goplus/xgo v1.6.6 // indirect
17+
github.com/goplus/xgo v1.6.7 // indirect
1818
github.com/petermattis/goid v0.0.0-20250721140440-ea1c0173183e // indirect
1919
github.com/qiniu/x v1.16.5 // indirect
2020
golang.org/x/image v0.23.0 // indirect

tools/spxls/go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ github.com/goplus/spx/v2 v2.0.0-pre.48 h1:7SOl5inDxCuKsvwWteWjIaB5csqZtlvt7lQ1Lx
1313
github.com/goplus/spx/v2 v2.0.0-pre.48/go.mod h1:oP0YVzWNrczCyyO8qjYyni5sV4wJ3sqVkjCmc+P6jBo=
1414
github.com/goplus/xgo v1.6.6 h1:gfFoGYnyGfImt1aFEkK55TQTzNUDZQYDlWq9mRr3ors=
1515
github.com/goplus/xgo v1.6.6/go.mod h1:7ViCaG6azWTPIxxvXPtkod7J13IO06qKWHJSaQ2nqvY=
16+
github.com/goplus/xgo v1.6.7 h1:vPKx5ddOmx93oSan0rXTKWk6RO2/gJowBew9GFrUNcU=
17+
github.com/goplus/xgo v1.6.7/go.mod h1:8wsvmW48dGeZ+rCMqlk/MsNecp/snz/tUqNkXaLoe6U=
1618
github.com/goplus/xgolsw v0.17.0 h1:IZvqYIsTCpfMrVvsb3JQMd0WvtZj9PNp0uooEX5PfSg=
1719
github.com/goplus/xgolsw v0.17.0/go.mod h1:R61Je+Ps3trGmRV1pambjv0o0PUfHD5MRnNL6G+GC88=
20+
github.com/goplus/xgolsw v0.17.1-0.20260327033750-feb54c4edc9e h1:d09IJ0zUTX4XPg6QilBVNpgx1WsQMYaW65579hOH7nk=
21+
github.com/goplus/xgolsw v0.17.1-0.20260327033750-feb54c4edc9e/go.mod h1:Gh43ivd+brouDLQxF5UGYCTOKvd9l7dRQtsoGX4J1V0=
1822
github.com/petermattis/goid v0.0.0-20250721140440-ea1c0173183e h1:D0bJD+4O3G4izvrQUmzCL80zazlN7EwJ0PPDhpJWC/I=
1923
github.com/petermattis/goid v0.0.0-20250721140440-ea1c0173183e/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
2024
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

0 commit comments

Comments
 (0)