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

Ws symbols (continues from #510) #520

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Ws symbols (continues from #510) #520

wants to merge 9 commits into from

Conversation

cristianoc
Copy link
Collaborator

@cristianoc cristianoc commented Jul 26, 2022

rebased on master of #510

@cristianoc
Copy link
Collaborator Author

linux: 30s until fail
macOS: 40s until fail
win: 57s until fail

@cristianoc
Copy link
Collaborator Author

On my dev machine time make -j test from scratch.
Master: about 12s.
PR: under 10s.

function workspaceSymbol(msg: p.RequestMessage) {
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_symbol
let result: p.WorkspaceSymbol[] | null = utils.runAnalysis(
["workspaceSymbols", process.cwd()],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This does not look right: process.cwd is not the current project.

CC @zth

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah this looks off. I wonder what to put there though, I guess we're looking for the current workspace root?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Current file I guess, if the extension gives it to you? Or whatever relevant info is given by vscode.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The spec doesn't seem to give us anything of value: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspaceSymbolParams

I guess we might have the workspaces by looking at the opened file contents cache. But that feels a bit tricky as that means it won't work if no file has been opened. Not sure how to proceed here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If no file open vscode does nothing at all.
Can't expect this feature to be different.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only possible choice I think is to look at the list of opened files, and get the list of opened projects from there.
Unless one can also have info about the current file.

What do other extensions do in that regard?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can support DidChangeWorkspaceFolders notification and register a cache. ocaml-lsp supports this notification.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That sounds like a good way to go.
I think it can be done/tested separately, then integrated in the PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it can be done/tested separately, then integrated in the PR?

Sure

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that sounds like a great solution!

@cristianoc cristianoc changed the title Ws symbols Ws symbols (continues from #510) Jul 26, 2022
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