-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: vb_ls #3917
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
Open
CoolCoderSuper
wants to merge
1
commit into
neovim:master
Choose a base branch
from
CoolCoderSuper:vb_ls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: vb_ls #3917
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
---@brief | ||
--- | ||
--- https://github.com/CoolCoderSuper/visualbasic-language-server | ||
--- | ||
--- Language Server for VB.NET. | ||
--- | ||
--- vb-ls requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed. | ||
--- | ||
--- The preferred way to install vb-ls is with `dotnet tool install --global vb-ls`. | ||
--- Additionally you need to register the .vb extension with the vbnet filetype. | ||
--- A plugin that does this as well as improved syntax highlighting is [vbnet.nvim](https://github.com/CoolCoderSuper/vbnet.nvim). | ||
|
||
local util = require 'lspconfig.util' | ||
|
||
return { | ||
cmd = { 'vb-ls' }, | ||
root_dir = function(bufnr, on_dir) | ||
local fname = vim.api.nvim_buf_get_name(bufnr) | ||
on_dir(util.root_pattern '*.sln'(fname) or util.root_pattern '*.vbproj'(fname) or util.root_pattern '*.slnx'(fname)) | ||
end, | ||
filetypes = { 'vbnet' }, | ||
init_options = { | ||
AutomaticWorkspaceInit = true, | ||
}, | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Where is the "vbnet" filetype coming from, a thirdparty plugin I assume (should mention and link to it in the doc)? The filetype shipped w/ vim is "vb": https://github.com/neovim/neovim/blob/5cf135f9a0ac472621d133bb4a03780a7bff6640/runtime/lua/vim/filetype/detect.lua#L107
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, that was one of my questions.
The reason for it is that the built in vb targetting VB6 and vb.net do differ in some areas but I can switch it to vb.
The patched version I have been using is here.
https://github.com/CoolCoderSuper/visualbasic-language-server/blob/main/vim-config/syntax/vbnet.vim
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.
So this config will work for exactly 1 person currently? :)
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.
You can use
:h vim.filetype.add
to create filetypevbnet
based on the presence ofvbproj
, and clarify these setup on docsThere 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.
@sharpchen thanks for the guidance. I will look into that and update the docs.
Uh oh!
There was an error while loading. Please reload this page.
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.
And for the syntax for
vbnet
you should wrap it as a vim plugin so others can install it, should look like https://github.com/vim-scripts/vbnet.vim, not related to ls config but it's worth noting.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.
@justinmk I understand, just to mention the workaround to manage external filetype for language server if needed, it should be added to user config, not related to lspconfig, thanks for clarification :)
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.
Thank you both for your feedback.
I created this plugin https://github.com/CoolCoderSuper/vbnet.nvim and added a reference to it in the doc.
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.
@CoolCoderSuper I was expecting https://github.com/CoolCoderSuper/vbnet.nvim to be a pure syntax plugin, it seems you're enforcing user to override
vb
tovbnet
, I do think we should leave it to user to decide whether to override or not if distinction between vb6 and vb.net does matter, as you mentioned earlier. something like this:With snippet above, all buffer with extension
vb
would be of filetypevbnet
when it find avbproj
upward, otherwise it would be justvb
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.
@sharpchen OK, that makes sense. I have updated it to use that approach.