-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(tools/spxls): improve completion support #1215
Conversation
Skipping CI for Draft Pull Request. |
f149ca5
to
0fc26e6
Compare
0fc26e6
to
821b341
Compare
58cb812
to
1e5dea5
Compare
1e5dea5
to
65674d9
Compare
65674d9
to
a3c1dd2
Compare
a3c1dd2
to
3b8159d
Compare
3b8159d
to
e7daa88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
spx-gui/src/components/editor/code-editor/document-base/gop.ts:80
- The 'TODO' comment in the 'definition' field should be resolved to ensure the 'name' is accurate and finalized.
definition: { name: 'import_declaration' }, // TODO
tools/spxls/internal/server/spx_definition.go:310
- [nitpick] The use of the string literal "main" could be replaced with a constant or predefined variable to avoid magic strings.
if pkg.Path() != "main" {
for scope := ctx.innermostScope; scope != nil; scope = scope.Parent() { | ||
for _, name := range scope.Names() { | ||
obj := scope.Lookup(name) | ||
if !isExportedOrMainPkgObject(obj) || !isTypeCompatible(obj.Type(), ctx.expectedType) { | ||
if !isExportedOrMainPkgObject(obj) || !isTypeCompatible(obj.Type(), typ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: 看到这里代码想到有一种 case,不确定有没有被覆盖到:
println "size:", size
setXpos ypos
currentVisible := visible
按 gop 的设定,这里的 size
、ypos
等是希望用户用着就像在用 field(甚至 variable)一样,所以在补全中最好也会出现
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在 https://github.com/goplus/builder/compare/e7daa88a627b0ddb675f5e3ab2b0bb1fe5fb897c..c4267bd24fc35158b0a0d7fb65e72f9b08344a47 中调整了一下类型匹配过滤的逻辑,给 SpxDefinition
引入了个 Type
字段,用作在创建 SpxDefinition
时提供的类型提示,这样方便尽可能地采集所有能用的项。
另外 println
有点特殊,它被识别成了 invalid type
且没有签名,应该是因为 gop 对这几个 builtin 方法做了特殊转换的关系。这个我打算放到后面要做的 gop builtin 支持中一起处理。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
Updates goplus#1199: - goplus#1199 (comment) - goplus#1199 (comment) Signed-off-by: Aofei Sheng <[email protected]>
e7daa88
to
c4267bd
Compare
This PR has been deployed to the preview environment. You can explore it using the preview URL. Warning Please note that deployments in the preview environment are temporary and will be automatically cleaned up after a certain period. Make sure to explore it before it is removed. For any questions, contact the Go+ Builder team. |
Updates #1199: