-
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.
Support gleamlsp language server for gleam (#4696)
- Loading branch information
Showing
7 changed files
with
62 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,18 @@ | ||
" Author: Jonathan Palardt https://github.com/jpalardy | ||
" Description: Support for Gleam Language Server | ||
|
||
call ale#Set('gleam_gleamlsp_executable', 'gleam') | ||
|
||
function! ale_linters#gleam#gleamlsp#GetProjectRoot(buffer) abort | ||
let l:gleam_toml = ale#path#FindNearestFile(a:buffer, 'gleam.toml') | ||
|
||
return !empty(l:gleam_toml) ? fnamemodify(l:gleam_toml, ':p:h') : '' | ||
endfunction | ||
|
||
call ale#linter#Define('gleam', { | ||
\ 'name': 'gleamlsp', | ||
\ 'lsp': 'stdio', | ||
\ 'executable': {buffer -> ale#Var(buffer, 'gleam_gleamlsp_executable')}, | ||
\ 'command': '%e lsp', | ||
\ 'project_root': function('ale_linters#gleam#gleamlsp#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,23 @@ | ||
=============================================================================== | ||
ALE Gleam Integration *ale-gleam-options* | ||
*ale-integration-gleam* | ||
|
||
=============================================================================== | ||
Integration Information | ||
|
||
Currently, the only supported linter for gleam is gleamlsp. | ||
|
||
|
||
=============================================================================== | ||
gleamlsp *ale-gleam-gleamlsp* | ||
|
||
g:ale_gleam_gleamlsp_executable *g:ale_gleam_gleamlsp_executable* | ||
*b:ale_gleam_gleamlsp_executable* | ||
Type: |String| | ||
Default: `'gleam'` | ||
|
||
This variable can be modified to change the executable path for `gleamlsp`. | ||
|
||
|
||
=============================================================================== | ||
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,15 @@ | ||
Before: | ||
call ale#assert#SetUpLinterTest('gleam', 'gleamlsp') | ||
|
||
After: | ||
call ale#assert#TearDownLinterTest() | ||
|
||
Execute(The default executable path should be correct): | ||
AssertLinter 'gleam', ale#Escape('gleam') . ' lsp' | ||
|
||
Execute(The project root should be detected correctly): | ||
AssertLSPProject '' | ||
|
||
call ale#test#SetFilename('../test-files/gleam/gleam.toml') | ||
|
||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/gleam') |
Empty file.