Support astgrep (#4975)
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

* astgrep: support its LSP

Fixes: #4974

* astgrep: add a fixer
This commit is contained in:
Ben Boeckel
2026-07-25 23:08:59 +09:00
committed by GitHub
parent 40cbe2121b
commit 9e2efaa4d3
83 changed files with 678 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for c files
call ale#handlers#astgrep#Define('c')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for cpp files
call ale#handlers#astgrep#Define('cpp')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for cs files
call ale#handlers#astgrep#Define('cs')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for css files
call ale#handlers#astgrep#Define('css')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for elixir files
call ale#handlers#astgrep#Define('elixir')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for go files
call ale#handlers#astgrep#Define('go')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for haskell files
call ale#handlers#astgrep#Define('haskell')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for html files
call ale#handlers#astgrep#Define('html')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for java files
call ale#handlers#astgrep#Define('java')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for javascript files
call ale#handlers#astgrep#Define('javascript')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for json files
call ale#handlers#astgrep#Define('json')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for kotlin files
call ale#handlers#astgrep#Define('kotlin')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for lua files
call ale#handlers#astgrep#Define('lua')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for nix files
call ale#handlers#astgrep#Define('nix')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for php files
call ale#handlers#astgrep#Define('php')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for python files
call ale#handlers#astgrep#Define('python')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for ruby files
call ale#handlers#astgrep#Define('ruby')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for rust files
call ale#handlers#astgrep#Define('rust')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for scala files
call ale#handlers#astgrep#Define('scala')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for sh files
call ale#handlers#astgrep#Define('sh')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for solidity files
call ale#handlers#astgrep#Define('solidity')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for swift files
call ale#handlers#astgrep#Define('swift')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for tsx files
call ale#handlers#astgrep#Define('tsx')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for typescript files
call ale#handlers#astgrep#Define('typescript')
+4
View File
@@ -0,0 +1,4 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: astgrep for yaml files
call ale#handlers#astgrep#Define('yaml')
+5
View File
@@ -22,6 +22,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['apkbuild'],
\ 'description': 'Fix policy violations found by apkbuild-lint in APKBUILDs',
\ },
\ 'ast-grep': {
\ 'function': 'ale#fixers#astgrep#Fix',
\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'css', 'elixer', 'go', 'haskell', 'html', 'java', 'javascript', 'json', 'kotlin', 'lua', 'nix', 'php', 'python', 'ruby', 'rust', 'scala', 'sh', 'solidity', 'swift', 'tsx', 'typescript', 'yaml'],
\ 'description': 'Apply ast-grep rules.',
\ },
\ 'autoimport': {
\ 'function': 'ale#fixers#autoimport#Fix',
\ 'suggested_filetypes': ['python'],
+18
View File
@@ -0,0 +1,18 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: Fix files with `ast-grep`.
call ale#Set('astgrep_executable', 'ast-grep')
call ale#Set('astgrep_scan_options', '--update-all')
function! ale#fixers#astgrep#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'astgrep_executable')
let l:options = ale#Var(a:buffer, 'astgrep_scan_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' scan'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction
+29
View File
@@ -0,0 +1,29 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: A CLI tool for code structural search, lint and rewriting
call ale#Set('astgrep_executable', 'ast-grep')
function! ale#handlers#astgrep#GetCommand(buffer) abort
return '%e lsp'
endfunction
function! ale#handlers#astgrep#GetProjectRoot(buffer) abort
" Try to find nearest sgconfig.yml
let l:sgconfig_file = ale#path#FindNearestFile(a:buffer, 'sgconfig.yml')
if !empty(l:sgconfig_file)
return fnamemodify(l:sgconfig_file . '/', ':p:h:h')
endif
return ''
endfunction
function! ale#handlers#astgrep#Define(lang) abort
call ale#linter#Define(a:lang, {
\ 'name': 'astgrep',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'astgrep_executable')},
\ 'command': function('ale#handlers#astgrep#GetCommand'),
\ 'project_root': function('ale#handlers#astgrep#GetProjectRoot'),
\})
endfunction
+43
View File
@@ -0,0 +1,43 @@
===============================================================================
ALE Generic Integration *ale-generic-options*
*ale-integration-generic*
===============================================================================
Integration Information
Some tools are not language specific. This document collects information on
ale's support for these tools.
===============================================================================
astgrep *ale-generic-astgrep*
`'ast-grep'` is a tool which can detect code patterns and offer fixes based
on various languages' abstract syntax trees (ASTs) using tree-sitter.
*ale-options.astgrep_executable*
*g:ale_astgrep_executable*
*b:ale_astgrep_executable*
astgrep_executable
g:ale_astgrep_executable
Type: |String|
Default: `'ast-grep'`
This variable can be modified to change the executable path for
`ast-grep`.
*ale-options.astgrep_scan_options*
*g:ale_astgrep_scan_options*
*b:ale_astgrep_scan_options*
astgrep_scan_options
g:ale_astgrep_scan_options
Type: |String|
Default: `'--update-all'`
This variable can be modified to change the options when applying rules with
the `ast-grep scan` command.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
@@ -231,6 +231,8 @@ Notes:
* `proselint`
* FusionScript
* `fusion-lint`
* Generic
* `ast-grep`
* Git Commit Messages
* `gitlint`
* Gleam
+2
View File
@@ -3593,6 +3593,8 @@ documented in additional help files.
fountain................................|ale-fountain-options|
fusionscript............................|ale-fuse-options|
fusion-lint...........................|ale-fuse-fusionlint|
generic.................................|ale-generic-options|
astgrep...............................|ale-generic-astgrep|
git commit..............................|ale-gitcommit-options|
gitlint...............................|ale-gitcommit-gitlint|
gleam...................................|ale-gleam-options|
+2
View File
@@ -241,6 +241,8 @@ formatting.
* [proselint](http://proselint.com/)
* FusionScript
* [fusion-lint](https://github.com/RyanSquared/fusionscript)
* Generic
* [ast-grep](https://ast-grep.github.io/)
* Git Commit Messages
* [gitlint](https://github.com/jorisroovers/gitlint)
* Gleam
@@ -0,0 +1,27 @@
Before:
Save g:ale_astgrep_executable
Save g:ale_astgrep_scan_options
After:
Restore
Execute(The ast-grep callback should return the correct default values):
AssertEqual
\ {
\ 'command': ale#Escape('ast-grep') . ' scan --update-all %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#astgrep#Fix(bufnr(''))
Execute(The astgrep executable and options should be configurable):
let g:ale_astgrep_executable = '/path/to/ast-grep'
let g:ale_astgrep_scan_options = '--interactive'
AssertEqual
\ {
\ 'command': ale#Escape('/path/to/ast-grep')
\ . ' scan'
\ . ' --interactive %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#astgrep#Fix(bufnr(''))
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('c', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.c')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('cpp', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.cpp')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('cs', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.cs')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('css', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.css')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('elixir', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.ex')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('go', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.go')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('haskell', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.hs')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('html', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.html')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('java', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.java')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('javascript', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.js')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('json', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.json')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('kotlin', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.kt')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('lua', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.lua')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('nix', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.nix')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('php', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.php')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('python', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.py')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('ruby', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.rb')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('rust', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.rs')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('scala', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.scala')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('sh', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.sh')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('solidity', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.sol')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('swift', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.swift')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('tsx', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.tsx')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('typescript', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.ts')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''
+18
View File
@@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('yaml', 'astgrep')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ast-grep', ale#Escape('ast-grep') . ' lsp'
Execute(The project root should be detected correctly with a configuration file):
call ale#test#SetFilename('../test-files/generic/astgrep/subdir/file.yaml')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/generic/astgrep')
Execute(The project root should be empty when no project files can be detected):
call ale#test#SetFilename('../test-files/dummy')
AssertLSPProject ''