-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for Odin language server (ols). (#4679)
- Loading branch information
1 parent
38c3130
commit 8b8ddea
Showing
7 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,19 @@ | ||
" Author: Benjamin Block <https://github.com/benjamindblock> | ||
" Description: A language server for Odin. | ||
|
||
function! ale_linters#odin#ols#GetProjectRoot(buffer) abort | ||
return fnamemodify('', ':h') | ||
endfunction | ||
|
||
call ale#Set('odin_ols_executable', 'ols') | ||
call ale#Set('odin_ols_config', {}) | ||
|
||
call ale#linter#Define('odin', { | ||
\ 'name': 'ols', | ||
\ 'lsp': 'stdio', | ||
\ 'language': 'odin', | ||
\ 'lsp_config': {b -> ale#Var(b, 'odin_ols_config')}, | ||
\ 'executable': {b -> ale#Var(b, 'odin_ols_executable')}, | ||
\ 'command': '%e', | ||
\ 'project_root': function('ale_linters#odin#ols#GetProjectRoot'), | ||
\}) |
This file contains 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,29 @@ | ||
=============================================================================== | ||
ALE Odin Integration *ale-odin-options* | ||
*ale-integration-odin* | ||
|
||
=============================================================================== | ||
Integration Information | ||
|
||
Currently, the only supported linter for Odin is ols. | ||
|
||
=============================================================================== | ||
ols *ale-odin-ols* | ||
|
||
g:ale_odin_ols_executable *g:ale_odin_ols_executable* | ||
*b:ale_odin_ols_executable* | ||
Type: |String| | ||
Default: `'ols'` | ||
|
||
This variable can be modified to change the executable path for `ols`. | ||
|
||
|
||
g:ale_odin_ols_config *g:ale_odin_ols_config* | ||
*b:ale_odin_ols_config* | ||
Type: |Dictionary| | ||
Default: `{}` | ||
|
||
Dictionary with configuration settings for ols. | ||
|
||
=============================================================================== | ||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,16 @@ | ||
Before: | ||
call ale#assert#SetUpLinterTest('odin', 'ols') | ||
|
||
After: | ||
call ale#assert#TearDownLinterTest() | ||
|
||
Execute(The default executable path should be correct): | ||
AssertLinter 'ols', ale#Escape('ols') | ||
|
||
Execute(The LSP values should be set correctly): | ||
call ale#test#SetFilename('../test-files/odin/main.odin') | ||
|
||
AssertLSPLanguage 'odin' | ||
AssertLSPOptions {} | ||
AssertLSPConfig {} | ||
AssertLSPProject '.' |
Empty file.