Support gleamlsp language server for gleam (#4696)

This commit is contained in:
Jonathan Palardy
2024-01-14 03:43:59 -08:00
committed by GitHub
parent 32e6fc5975
commit ebc6718c0a
7 changed files with 62 additions and 0 deletions

View File

@@ -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'),
\})

23
doc/ale-gleam.txt Normal file
View File

@@ -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:

View File

@@ -202,6 +202,8 @@ Notes:
* `fusion-lint`
* Git Commit Messages
* `gitlint`
* Gleam
* `gleamlsp`
* GLSL
* `glslang`
* `glslls`

View File

@@ -3031,6 +3031,8 @@ documented in additional help files.
fusion-lint...........................|ale-fuse-fusionlint|
git commit..............................|ale-gitcommit-options|
gitlint...............................|ale-gitcommit-gitlint|
gleam...................................|ale-gleam-options|
gleamlsp..............................|ale-gleam-gleamlsp|
glsl....................................|ale-glsl-options|
glslang...............................|ale-glsl-glslang|
glslls................................|ale-glsl-glslls|

View File

@@ -211,6 +211,8 @@ formatting.
* [fusion-lint](https://github.com/RyanSquared/fusionscript)
* Git Commit Messages
* [gitlint](https://github.com/jorisroovers/gitlint)
* Gleam
* [gleamlsp](https://github.com/gleam-lang/gleam)
* GLSL
* [glslang](https://github.com/KhronosGroup/glslang)
* [glslls](https://github.com/svenstaro/glsl-language-server)

View File

@@ -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')

View File