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: add delphilsp support #3034

Merged
merged 3 commits into from
Feb 29, 2024
Merged

feat: add delphilsp support #3034

merged 3 commits into from
Feb 29, 2024

Conversation

Str8Razor
Copy link
Contributor

Add support for Delphi Language Server, which is available only for Windows.
The config file for the language server *.delphilsp.json is located in the root_dir.
Unfortunately the root_dir is not available at the configuration creation time,
so I had to look for it. Maybe, there is a better solution?

@Str8Razor Str8Razor requested a review from glepnir as a code owner February 26, 2024 20:37
if dpr_path then
return vim.fs.find(function(name)
return name:match '.*%.delphilsp.json$'
end, { type = 'file', path = vim.fs.dirname(dpr_path), upward = false })[1]
Copy link
Member

Choose a reason for hiding this comment

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

dirname is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, it is required. The dpr_path contains file name that needs to be removed for vim.fs.find to work.
It would be nice to replace the dpr_path with root_dir, as Delphi's lsp config and project file are always located in the root folder. With current implementation we have to look for the same folder twice, first time for lsp config and second time for the root_dir

Copy link
Member

Choose a reason for hiding this comment

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

what about if find return an empty table ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting DelphiLSP configuration on server setup was wrong, @glepnir thank you for being patient with me.
The proper way is to send it to LS through didChangeConfiguration on on_attach.
At this point the root_dir is already set.
I've added a configuration sample in the documentation section of delphi_ls.

@Str8Razor Str8Razor requested a review from glepnir February 28, 2024 20:43
@glepnir glepnir merged commit 078410f into neovim:master Feb 29, 2024
9 checks passed
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.

2 participants