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

Need LSP workspace folders and events #4

Closed
olegklimov opened this issue Feb 7, 2024 · 13 comments
Closed

Need LSP workspace folders and events #4

olegklimov opened this issue Feb 7, 2024 · 13 comments
Assignees

Comments

@olegklimov
Copy link
Contributor

Now refact-lsp receives:

2024-02-07T09:12:02.530871Z  INFO refact_lsp::lsp:180: LSP client_info None
2024-02-07T09:12:02.530875Z  INFO refact_lsp::lsp:184: LSP workspace_folders RwLock { data: None }

But it needs workspace folders to index the files inside. I have two Sublime windows open, with different paths. Both need to be visible in workspace_folders.

Another problem is it needs these LSP events for specific files:

did_open
did_change
did_save
did_close

And finally for statistics we need handle_v1_snippet_accepted (actually an analog of this in LSP RPC) when a grey text code completion is accepted (Tab).

@reymondzzzz
Copy link
Member

I added refact/acceptCompletion method. Params: {snippet_telemetry_id: int}. snippet_telemetry_id came from refact/getCompletions

@digital-phoenix
Copy link
Contributor

The code already sends didopen and didchange events with the corresponding file name.

@olegklimov
Copy link
Contributor Author

didopen
I didn't see any open event, it needs to post 'open' for each file open on Sublime startup for example.

@digital-phoenix
Copy link
Contributor

digital-phoenix commented Feb 7, 2024

Every time the user interacts with a new file refact_sessions calls load_document which sends a didOpen event. It even handles temporary unnamed files.

@digital-phoenix
Copy link
Contributor

@olegklimov is the issue that the plugin only provides open messages for files after the user interacts with them? Do you want the plugin to send didOpen messages on launch as well?

@olegklimov
Copy link
Contributor Author

I've tested quickly again, it's true "changed" arrives when I edit the code:

changed ...rc/vecdb/vectorizer_service.rs, total time 83.583µs

But I don't see "opened" whatever I do.

on launch as well

Sure.

@olegklimov
Copy link
Contributor Author

olegklimov commented Mar 3, 2024

workspaces -- doesn't work, workspace_folders always empty list []
didOpen -- doesn't work (at start, clicking in a file the tree, Ctrl+O -- all three ways to open a file don't produce the message)
didChange -- ✅ works
didSave -- ✅ works
didClone -- ✅ works

@digital-phoenix
Copy link
Contributor

@olegklimov how do you want workspaces to work here? Are you sure didOpen isn't working I can see it's sending the message to the server and it's using the same mechanism as the ones that are working.

@olegklimov
Copy link
Contributor Author

workspaces

You can open a folder in Sublime, a new window opens, and all the tools like search work for all the files in that folder. So that's a good candidate for a workspace dir, organized in a list for all open windows that have folders associated.

didOpen

I noticed that too. In Sublime console there's a message, and then it gets lost somewhere along the way. refact-lsp has no problem catching didOpen:

cat ~/.cache/refact/logs/rustbinary.2024-03-05 | grep --color "opened "

image

@digital-phoenix
Copy link
Contributor

So you only want a workspace to be created if the user directly opens a folder? I'm not sure what those opened messages are indicating? Are they showing didOpen messages being received on the server or are they showing something else entirely?

@olegklimov
Copy link
Contributor Author

created

reported

workspace to be created if the user directly opens a folder

or starts Sublime so all the windows are restored back as they were the previous time

showing didOpen messages being received

yes, didOpen messages sent by VSCode and received fine, demonstrating didOpen works on the server side

@hazratisulton
Copy link

Checked #16.
workspaces -- doesn't work
didOpen -- working (clicking in a file the tree, Ctrl+O)
didOpen at start - message appears when you click in the selected file

@hazratisulton
Copy link

Checked.
workspaces - work, workspace_folders shows open folders.
didOpen -- working (clicking in a file the tree, Ctrl+O)
didOpen at start - message appears when you click in the selected file (In VS Code message appears when you click on the title of the selected file)

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

No branches or pull requests

4 participants