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

feature: integrate vim.diagnostics with vscode.Diagnostics #1993

Open
theol0403 opened this issue May 20, 2024 · 18 comments
Open

feature: integrate vim.diagnostics with vscode.Diagnostics #1993

theol0403 opened this issue May 20, 2024 · 18 comments

Comments

@theol0403
Copy link
Member

theol0403 commented May 20, 2024

:h diagnostic-api has a bunch of methods to interact with buffer diagnostics. VScode also provides a Diagnostics API.

The main value for this is to hook vim.diagnostic.goto_next(severity) and vim.diagnostic.goto_prev(severity), which many people bind to ]e and [e, ]d, [d, etc.

However, full integration may be useful for plugins that interact with diagnostics or complex bindings.

Should be relatively doable.

@xiyaowong
Copy link
Collaborator

I did think about it, too. However, I am worried that it will bring more confusion to users than benefits.

@ollien
Copy link
Collaborator

ollien commented May 21, 2024

I might give this a crack. I often find myself trying to use the minimap to find diagnostics, so I would actually use this

@theol0403
Copy link
Member Author

Don't we want to support as many bindings out of the box as possible? Maybe we do not need the full integration, but hooking the navigation commands will be beneficial.

@xiyaowong
Copy link
Collaborator

How about creating a temporary nvim plugin for developing this feature? It would facilitate testing and contributions. Besides vim.diagnostics, there might be other functionalities as well. Once it’s refined, we can consider integrating it into vscode-neovim.

@theol0403
Copy link
Member Author

Sounds good to me. There's some functionality from multi-cursor that I want to move to core as well, we should maybe create a "staging" extension to test experimental integrations.

@ollien
Copy link
Collaborator

ollien commented May 21, 2024

How does an extension look, to you, if we have to integrate with VSCode functionality that isn't otherwise supported by vscode-neovim? I haven't investigated the multi-cursor extension too much, so maybe there's an "obvious" answer. Is it just "use a lot of eval"? haha

@theol0403
Copy link
Member Author

I might give this a crack. I often find myself trying to use the minimap to find diagnostics, so I would actually use this

Perhaps we can use this as a proof of concept of one of the first features that would traditionally require support code on the extension side but we implement purely through Lua.

@theol0403
Copy link
Member Author

Yeah traditionally we'd create a custom request and provide support on the vscode side. But we can try using only eval.

@ollien
Copy link
Collaborator

ollien commented May 21, 2024

I'd prefer to avoid eval, as I think the semantics of that might be a bit weird (especially if we're using typescript, we'd have to compile down something minified to shove through, or put it all in lua strings. Neither is super elegant).

I need to look more closely at the request mechanism between the lua and TS side, but maybe we can have extensions do a single eval to "register" what requests they want somehow.

@theol0403
Copy link
Member Author

Perhaps. Features like this are good examples of features that work in isolation, so would be nice to bundle as extension.

We could potentially bundle a ts file next to the Lua file, full of hooks, that we send over.

Otherwise, adding core support is fine.

Probably don't need access to the buffer manager to get the buffer URI, can use vscode.focusedEditor (something similar)

@xiyaowong
Copy link
Collaborator

Wait, do we really need full support for all these functions? That could be quite a lot of work. Maybe we could create a VS Code extension to handle this

@ollien
Copy link
Collaborator

ollien commented May 21, 2024

Otherwise, adding core support is fine.

Maybe there's some history I'm not understanding here, so please do let me know if I'm off base, but if we're modifying core anyway, what's the benefit of having a separate nvim plugin?

@theol0403
Copy link
Member Author

theol0403 commented May 21, 2024

If we're modifying core, then yes, there can't be an external plugin.

@xiyaowong
Copy link
Collaborator

what's the benefit of having a separate nvim plugin?

My original purpose was to facilitate development and contribution.

@xiyaowong
Copy link
Collaborator

xiyaowong commented May 21, 2024

We can export MainController for other vscode extensins, return "plugin" in the activate function

Currently there is a command "_getNvimClient" to get the nvim client. https://github.com/xiyaowong/vscode-tab-picker will use it.

@justinmk
Copy link
Collaborator

The main value for this is to hook vim.diagnostic.goto_next(severity) and vim.diagnostic.goto_prev(severity), which many people bind to ]e and [e, ]d, [d, etc.

This is a pretty weak justification, since those can be remapped to vscode variants.

Is there other motivation for this?

@theol0403
Copy link
Member Author

Yes, the main purpose of this request is to map vscode variants. However, the main obstacle is there are no vscode commands to navigate by severity, so we would need to add some custom plumbing to provide the same API.

@justinmk
Copy link
Collaborator

Yes, the main purpose of this request is to map vscode variants. However, the main obstacle is there are no vscode commands to navigate by severity,

Is that worth the extra code?

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