mirror of
https://github.com/dense-analysis/ale.git
synced 2026-09-02 21:06:56 +08:00
feat: openscad-lsp support (#5156)
CI / Build (push) Canceled after 0s
CI / Neovim 0.10 Windows (push) Canceled after 0s
CI / Neovim 0.12 Windows (push) Canceled after 0s
CI / Vim 8.2 Windows (push) Canceled after 0s
CI / Vim 9.2 Windows (push) Canceled after 0s
CI / Lint (push) Canceled after 0s
CI / Lua (push) Canceled after 0s
CI / Neovim 0.10 Linux (push) Canceled after 0s
CI / Neovim 0.12 Linux (push) Canceled after 0s
CI / Vim 8.2 Linux (push) Canceled after 0s
CI / Vim 9.2 Linux (push) Canceled after 0s
CI / Build (push) Canceled after 0s
CI / Neovim 0.10 Windows (push) Canceled after 0s
CI / Neovim 0.12 Windows (push) Canceled after 0s
CI / Vim 8.2 Windows (push) Canceled after 0s
CI / Vim 9.2 Windows (push) Canceled after 0s
CI / Lint (push) Canceled after 0s
CI / Lua (push) Canceled after 0s
CI / Neovim 0.10 Linux (push) Canceled after 0s
CI / Neovim 0.12 Linux (push) Canceled after 0s
CI / Vim 8.2 Linux (push) Canceled after 0s
CI / Vim 9.2 Linux (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
" Author: Johan Niklasson <johan@niklasson-embedded.se>
|
||||||
|
" Description: openscad-lsp support for OpenSCAD
|
||||||
|
|
||||||
|
call ale#Set('openscad_openscad_lsp_executable', 'openscad-lsp')
|
||||||
|
call ale#Set('openscad_openscad_lsp_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#openscad#openscad_lsp#GetProjectRoot(buffer) abort
|
||||||
|
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||||
|
|
||||||
|
if !empty(l:git_path)
|
||||||
|
return fnamemodify(l:git_path, ':h:h')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return expand('#' . a:buffer . ':p:h')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('openscad', {
|
||||||
|
\ 'name': 'openscad_lsp',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'openscad_openscad_lsp_executable')},
|
||||||
|
\ 'command': {b -> '%e --stdio' . ale#Pad(ale#Var(b, 'openscad_openscad_lsp_options'))},
|
||||||
|
\ 'project_root': function('ale_linters#openscad#openscad_lsp#GetProjectRoot'),
|
||||||
|
\})
|
||||||
@@ -2,6 +2,27 @@
|
|||||||
ALE OpenSCAD Integration *ale-openscad-options*
|
ALE OpenSCAD Integration *ale-openscad-options*
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
openscad-lsp *ale-openscad-openscad_lsp*
|
||||||
|
|
||||||
|
`openscad-lsp` is a Language Server Protocol implementation for OpenSCAD.
|
||||||
|
|
||||||
|
g:ale_openscad_openscad_lsp_executable *g:ale_openscad_openscad_lsp_executable*
|
||||||
|
*b:ale_openscad_openscad_lsp_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'openscad-lsp'`
|
||||||
|
|
||||||
|
This variable can be changed to use a different executable for openscad-lsp.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_openscad_openscad_lsp_options *g:ale_openscad_openscad_lsp_options*
|
||||||
|
*b:ale_openscad_openscad_lsp_options*
|
||||||
|
Type: |String|
|
||||||
|
Default: `''`
|
||||||
|
|
||||||
|
This variable can be changed to pass additional flags to openscad-lsp.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
sca2d *ale-openscad-sca2d*
|
sca2d *ale-openscad-sca2d*
|
||||||
|
|
||||||
|
|||||||
@@ -505,6 +505,7 @@ Notes:
|
|||||||
* `yamllint`
|
* `yamllint`
|
||||||
* OpenSCAD
|
* OpenSCAD
|
||||||
* `SCA2D`
|
* `SCA2D`
|
||||||
|
* `openscad-lsp`
|
||||||
* `scadformat`
|
* `scadformat`
|
||||||
* Packer
|
* Packer
|
||||||
* `packer-fmt-fixer`
|
* `packer-fmt-fixer`
|
||||||
|
|||||||
@@ -3839,6 +3839,7 @@ documented in additional help files.
|
|||||||
prettier..............................|ale-openapi-prettier|
|
prettier..............................|ale-openapi-prettier|
|
||||||
yamllint..............................|ale-openapi-yamllint|
|
yamllint..............................|ale-openapi-yamllint|
|
||||||
openscad................................|ale-openscad-options|
|
openscad................................|ale-openscad-options|
|
||||||
|
openscad-lsp..........................|ale-openscad-openscad_lsp|
|
||||||
sca2d.................................|ale-openscad-sca2d|
|
sca2d.................................|ale-openscad-sca2d|
|
||||||
scadformat............................|ale-openscad-scadformat|
|
scadformat............................|ale-openscad-scadformat|
|
||||||
packer..................................|ale-packer-options|
|
packer..................................|ale-packer-options|
|
||||||
|
|||||||
@@ -515,6 +515,7 @@ formatting.
|
|||||||
* [yamllint](https://yamllint.readthedocs.io/)
|
* [yamllint](https://yamllint.readthedocs.io/)
|
||||||
* OpenSCAD
|
* OpenSCAD
|
||||||
* [SCA2D](https://gitlab.com/bath_open_instrumentation_group/sca2d) :floppy_disk:
|
* [SCA2D](https://gitlab.com/bath_open_instrumentation_group/sca2d) :floppy_disk:
|
||||||
|
* [openscad-lsp](https://github.com/Leathong/openscad-LSP)
|
||||||
* [scadformat](https://github.com/hugheaves/scadformat)
|
* [scadformat](https://github.com/hugheaves/scadformat)
|
||||||
* Packer (HCL)
|
* Packer (HCL)
|
||||||
* [packer-fmt-fixer](https://github.com/hashicorp/packer)
|
* [packer-fmt-fixer](https://github.com/hashicorp/packer)
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Before:
|
||||||
|
call ale#assert#SetUpLinterTest('openscad', 'openscad_lsp')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
|
Execute(The default command should be correct):
|
||||||
|
AssertLinter 'openscad-lsp', ale#Escape('openscad-lsp') . ' --stdio'
|
||||||
|
|
||||||
|
Execute(The executable should be configurable):
|
||||||
|
let g:ale_openscad_openscad_lsp_executable = '/custom/path/openscad-lsp'
|
||||||
|
|
||||||
|
AssertLinter '/custom/path/openscad-lsp',
|
||||||
|
\ ale#Escape('/custom/path/openscad-lsp') . ' --stdio'
|
||||||
|
|
||||||
|
Execute(Options should be appended to the command):
|
||||||
|
let b:ale_openscad_openscad_lsp_options = '--ignore-default'
|
||||||
|
|
||||||
|
AssertLinter 'openscad-lsp',
|
||||||
|
\ ale#Escape('openscad-lsp') . ' --stdio --ignore-default'
|
||||||
Reference in New Issue
Block a user