Skip to content
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

feat(tools/spxls): implement textDocument/{prepareRename,rename,signatureHelp,documentHighlight} #1146

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

aofei
Copy link
Member

@aofei aofei commented Dec 16, 2024

Updates #1059

@aofei aofei requested a review from Copilot December 16, 2024 01:02
param := sig.Params().At(i)
paramsInfo = append(paramsInfo, ParameterInformation{
Label: param.Name() + " " + param.Type().String(),
// TODO: Add documentation.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Note is recommended to use "MARKER(uid): note body" format.

Details

lint 解释

这个lint结果提示在注释中使用“MARKER(uid): note body”格式是一个推荐的做法。这意味着在编写注释时,应该遵循这种特定的格式来提高代码的可读性和一致性。

错误用法

以下是一个错误的示例,展示了不正确的注释格式:

// 这是一个错误的注释格式
func exampleFunction() {
    // 这里是函数体
}

正确用法

以下是一个正确的示例,展示了遵循推荐格式的注释:

// MARKER(12345): 这是一个正确的注释格式
func exampleFunction() {
    // 这里是函数体
}

在这个正确示例中,“MARKER(12345)”部分是一个唯一的标识符,用于标记这个注释。注释的主体部分“这是一个正确的注释格式”则描述了注释的内容。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

return &SignatureHelp{
Signatures: []SignatureInformation{{
Label: label,
// TODO: Add documentation.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Note is recommended to use "MARKER(uid): note body" format.

Details

lint 解释

这个lint结果提示在注释中使用“MARKER(uid): note body”格式是一个推荐的做法。这意味着在编写注释时,应该遵循这种特定的格式来提高代码的可读性和一致性。

错误用法

以下是一个错误的示例,展示了不正确的注释格式:

// 这是一个错误的注释格式
func exampleFunction() {
    // 这里是函数体
}

正确用法

以下是一个正确的示例,展示了遵循推荐格式的注释:

// MARKER(12345): 这是一个正确的注释格式
func exampleFunction() {
    // 这里是函数体
}

在这个正确示例中,“MARKER(12345)”部分是一个唯一的标识符,用于标记这个注释。注释的主体部分“这是一个正确的注释格式”则描述了注释的内容。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

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 13 changed files in this pull request and generated no comments.

Files not reviewed (8)
  • tools/spxls/internal/server/highlight_test.go: Evaluated as low risk
  • tools/spxls/internal/server/signature_test.go: Evaluated as low risk
  • tools/spxls/internal/server/signature.go: Evaluated as low risk
  • tools/spxls/README.md: Evaluated as low risk
  • tools/spxls/internal/server/command.go: Evaluated as low risk
  • tools/spxls/internal/server/def.go: Evaluated as low risk
  • tools/spxls/internal/server/server.go: Evaluated as low risk
  • tools/spxls/internal/vfs/mapfs.go: Evaluated as low risk
Comments suppressed due to low confidence (1)

tools/spxls/internal/server/highlight.go:19

  • Add a check to ensure ident is not nil before using it to prevent potential runtime errors.
if obj == nil {

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 14 changed files in this pull request and generated no comments.

Files not reviewed (9)
  • tools/spxls/internal/server/highlight.go: Evaluated as low risk
  • tools/spxls/README.md: Evaluated as low risk
  • tools/spxls/internal/server/compile.go: Evaluated as low risk
  • tools/spxls/internal/server/def.go: Evaluated as low risk
  • tools/spxls/internal/server/document.go: Evaluated as low risk
  • tools/spxls/internal/server/server.go: Evaluated as low risk
  • tools/spxls/internal/vfs/mapfs.go: Evaluated as low risk
  • tools/spxls/internal/server/command.go: Evaluated as low risk
  • tools/spxls/internal/server/rename.go: Evaluated as low risk
@qiniu-ci
Copy link

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.


var highlights []DocumentHighlight
if isMainPkgObject(obj) {
highlights = append(highlights, DocumentHighlight{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥 ident.Pos()(应该差不多就是输入的位置)一定是 write?我以为 xxx = ... 这种才算 write

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯这个逻辑是有问题,我先给改成 Text 吧,然后在 textDocument/semanticTokens/full 中修复这个方法

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下边遍历 result.typeInfo.Uses 得到的项也先改成 Text?那边好像也不能确定是 Read

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…atureHelp,documentHighlight}`

Updates goplus#1059

Signed-off-by: Aofei Sheng <[email protected]>
Copy link

qiniu-prow bot commented Dec 16, 2024

@aofei: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
goplus-builder-pr-review-environment-test 5f0a05b link true /test goplus-builder-pr-review-environment-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@nighca nighca merged commit a635c99 into goplus:dev Dec 16, 2024
6 of 7 checks passed
@aofei aofei deleted the spxls branch December 16, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants