mirror of
https://github.com/dense-analysis/ale.git
synced 2026-10-27 16:13:16 +08:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c849345a8d | ||
|
|
014c959fee | ||
|
|
520c775c6a | ||
|
|
7f79d30fb9 |
No files matched your search
@@ -0,0 +1,62 @@
|
||||
---
|
||||
# Disabling building for AppVeyor. We are just testing things.
|
||||
build: false
|
||||
clone_depth: 10
|
||||
# Use the directory C:\testplugin so test directories will mostly work.
|
||||
clone_folder: C:\testplugin
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /v\d+\.\d+\.(x|\d+)/
|
||||
|
||||
# Skip running Windows tests if we only change files that can't impact
|
||||
# Windows tests.
|
||||
skip_commits:
|
||||
files:
|
||||
- '.github/**/*'
|
||||
- .gitattributes
|
||||
- Dockerfile
|
||||
- README.md
|
||||
- doc/*
|
||||
- lua/*
|
||||
- run-tests
|
||||
- supported-tools.md
|
||||
- syntax/*
|
||||
|
||||
# Cache the vim and vader directories between builds.
|
||||
cache:
|
||||
- C:\vim -> .appveyor.yml
|
||||
- C:\vader -> .appveyor.yml
|
||||
|
||||
init:
|
||||
# Stop git from changing newlines
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
# NOTE: If you change the Vim or Vader versions here, please also update the
|
||||
# instructions for running tests on Windows in ale-development.txt
|
||||
|
||||
install:
|
||||
# Download and unpack Vim
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vim)){
|
||||
Add-Type -A System.IO.Compression.FileSystem
|
||||
Invoke-WebRequest https://github.com/dense-analysis/ale/releases/download/v4.0.0/vim80-586w32.zip `
|
||||
-OutFile C:\vim.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim')
|
||||
Invoke-WebRequest https://github.com/dense-analysis/ale/releases/download/v4.0.0/vim80-586rt.zip `
|
||||
-OutFile C:\rt.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim')
|
||||
}
|
||||
# Clone Vader and check out the commit we want
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vader)){
|
||||
git clone https://github.com/junegunn/vader.vim C:\vader 2> $null
|
||||
cd C:\vader
|
||||
git checkout -qf c6243dd81c98350df4dec608fa972df98fa2a3af 2> $null
|
||||
}
|
||||
|
||||
test_script:
|
||||
- cd C:\testplugin
|
||||
- 'C:\vim\vim\vim80\vim.exe -u test\vimrc "+Vader!
|
||||
test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader"'
|
||||
@@ -1,9 +0,0 @@
|
||||
# Project-local Codex configuration.
|
||||
#
|
||||
# Command safety policy lives in .codex/rules/git-state.rules.
|
||||
|
||||
[[hooks.Stop]]
|
||||
[[hooks.Stop.hooks]]
|
||||
type = "command"
|
||||
command = "cat >> .codex/stop-trigger"
|
||||
timeout = 1
|
||||
@@ -1,90 +0,0 @@
|
||||
# Forbid Codex from changing Git repository state in this project.
|
||||
#
|
||||
# Read-only Git inspection, such as `git status`, `git diff`, `git log`, and
|
||||
# `git show`, is intentionally not matched by this policy.
|
||||
|
||||
prefix_rule(
|
||||
pattern = ["git", [
|
||||
"add",
|
||||
"am",
|
||||
"apply",
|
||||
"bisect",
|
||||
"branch",
|
||||
"checkout",
|
||||
"cherry-pick",
|
||||
"clean",
|
||||
"commit",
|
||||
"fetch",
|
||||
"merge",
|
||||
"mv",
|
||||
"notes",
|
||||
"pull",
|
||||
"push",
|
||||
"rebase",
|
||||
"reflog",
|
||||
"replace",
|
||||
"reset",
|
||||
"restore",
|
||||
"revert",
|
||||
"rm",
|
||||
"stash",
|
||||
"submodule",
|
||||
"switch",
|
||||
"tag",
|
||||
"update-index",
|
||||
"update-ref",
|
||||
"worktree",
|
||||
]],
|
||||
decision = "forbidden",
|
||||
justification = "Git commands that change the index, refs, branches, remotes, commits, or working tree are reserved for the user.",
|
||||
match = [
|
||||
"git add .",
|
||||
"git commit -m test",
|
||||
"git pull --rebase",
|
||||
"git reset --hard HEAD",
|
||||
"git restore --staged AGENTS.md",
|
||||
],
|
||||
not_match = [
|
||||
"git diff -- AGENTS.md",
|
||||
"git log --oneline -5",
|
||||
"git show HEAD",
|
||||
"git status --short",
|
||||
],
|
||||
)
|
||||
|
||||
prefix_rule(
|
||||
pattern = ["git", [
|
||||
"-C",
|
||||
"-c",
|
||||
"--bare",
|
||||
"--config-env",
|
||||
"--exec-path",
|
||||
"--git-dir",
|
||||
"--git-dir=.git",
|
||||
"--git-dir=/home/w0rp/ale/.git",
|
||||
"--namespace",
|
||||
"--no-optional-locks",
|
||||
"--no-pager",
|
||||
"--paginate",
|
||||
"-P",
|
||||
"--super-prefix",
|
||||
"--work-tree",
|
||||
"--work-tree=.",
|
||||
"--work-tree=/home/w0rp/ale",
|
||||
]],
|
||||
decision = "forbidden",
|
||||
justification = "Git global options can obscure or bypass repository state changes; run read-only Git commands from the repository root instead.",
|
||||
match = [
|
||||
"git -C /home/w0rp/ale status --short",
|
||||
"git --git-dir .git status",
|
||||
"git --git-dir=.git status",
|
||||
"git --no-pager add .",
|
||||
"git --work-tree . status",
|
||||
],
|
||||
not_match = [
|
||||
"git diff -- AGENTS.md",
|
||||
"git log --oneline -5",
|
||||
"git show HEAD",
|
||||
"git status --short",
|
||||
],
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
* @w0rp
|
||||
+10
-60
@@ -11,10 +11,9 @@ on: # yamllint disable-line rule:truthy
|
||||
|
||||
jobs:
|
||||
build_image:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build docker run image
|
||||
shell: bash
|
||||
env:
|
||||
@@ -22,67 +21,18 @@ jobs:
|
||||
DOCKER_HUB_PASS: ${{ secrets.DOCKER_HUB_PASS }}
|
||||
run: ./run-tests --build-image
|
||||
test_ale:
|
||||
name: ${{ matrix.name }}
|
||||
needs: build_image
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- name: Lint
|
||||
test-args: --linters-only
|
||||
- name: Lua
|
||||
test-args: --lua-only
|
||||
- name: Neovim 0.10 Linux
|
||||
test-args: --neovim-010-only
|
||||
- name: Neovim 0.12 Linux
|
||||
test-args: --neovim-012-only
|
||||
- name: Vim 8.2 Linux
|
||||
test-args: --vim-82-only
|
||||
- name: Vim 9.2 Linux
|
||||
test-args: --vim-92-only
|
||||
vim-version:
|
||||
- '--vim-80-only'
|
||||
- '--vim-90-only'
|
||||
- '--neovim-07-only'
|
||||
- '--neovim-08-only'
|
||||
- '--lua-only'
|
||||
- '--linters-only'
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run tests
|
||||
run: ./run-tests -v ${{ matrix.test-args }}
|
||||
test_ale_windows:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Neovim 0.10 Windows
|
||||
editor: neovim
|
||||
version: v0.10.4
|
||||
- name: Neovim 0.12 Windows
|
||||
editor: neovim
|
||||
version: v0.12.1
|
||||
- name: Vim 8.2 Windows
|
||||
editor: vim
|
||||
version: v8.2.4843
|
||||
- name: Vim 9.2 Windows
|
||||
editor: vim
|
||||
version: v9.2.0329
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup ${{ matrix.editor }} ${{ matrix.version }}
|
||||
uses: rhysd/action-setup-vim@v1
|
||||
id: editor
|
||||
with:
|
||||
neovim: ${{ matrix.editor == 'neovim' }}
|
||||
version: ${{ matrix.version }}
|
||||
- name: Clone Vader
|
||||
shell: cmd
|
||||
run: |
|
||||
git clone https://github.com/junegunn/vader.vim C:\vader
|
||||
git -C C:\vader checkout -qf c6243dd81c98350df4dec608fa972df98fa2a3af
|
||||
- name: Run tests
|
||||
shell: cmd
|
||||
env:
|
||||
VIM_EXE: ${{ steps.editor.outputs.executable }}
|
||||
VIM_HEADLESS: ${{ matrix.editor == 'neovim' && '--headless' || '--not-a-term' }}
|
||||
run: |
|
||||
set TMP=%CD:~0,2%\tmp
|
||||
set TEMP=%CD:~0,2%\tmp
|
||||
if not exist "%CD:~0,2%\tmp" mkdir "%CD:~0,2%\tmp"
|
||||
run-tests.bat
|
||||
run: ./run-tests -v ${{ matrix.vim-version }}
|
||||
@@ -1,3 +0,0 @@
|
||||
read_globals = {
|
||||
'vim',
|
||||
}
|
||||
@@ -1,23 +1,6 @@
|
||||
# ALE Instructions
|
||||
# ALE Agent instructions
|
||||
|
||||
## Basic Instructions
|
||||
|
||||
Read documentation from @doc/ale-development.txt to understand how to be an
|
||||
ALE developer and how to match our standards.
|
||||
|
||||
Run all tests quickly with `./run-tests -q --fast`, which picks the quickest
|
||||
version of Neovim we can run, and runs our linting checks.
|
||||
|
||||
You can quickly check an individual Vader test file by passing them as arguments
|
||||
such as `./run-tests -q --fast test/path/some_file.vader`.
|
||||
|
||||
You can quickly run all Lua tests with `./run-tests -q --lua-only`.
|
||||
|
||||
|
||||
For new Vim files, set `Author:` comments to the person doing the work.
|
||||
Do not use Codex, OpenAI, or other tool names as the author.
|
||||
|
||||
## Writing Tests
|
||||
|
||||
For `test/test-files` they should almost always be 0 bytes in size and files
|
||||
may be marked executable when testing searching for executables.
|
||||
1. Read documentation from `doc/ale-development.txt` to understand how to be an
|
||||
ALE developer.
|
||||
2. Run Vader/Vim tests with `./run-tests -q --fast test/path/some_file.vader`
|
||||
3. When editing Lua code run Lua tests with `./run-tests -q --lua-only`
|
||||
+10
-60
@@ -1,78 +1,28 @@
|
||||
#############################################################################
|
||||
# Base testbed image copied from:
|
||||
# https://github.com/Vimjas/vim-testbed/blob/master/Dockerfile
|
||||
FROM alpine:3.23 as testbed
|
||||
ARG TESTBED_VIM_VERSION=24
|
||||
|
||||
RUN apk --no-cache upgrade
|
||||
FROM testbed/vim:${TESTBED_VIM_VERSION}
|
||||
|
||||
ENV PACKAGES="\
|
||||
build-base \
|
||||
linux-headers \
|
||||
cmake \
|
||||
coreutils \
|
||||
msgpack-c-dev \
|
||||
libtermkey-dev \
|
||||
libvterm-dev \
|
||||
unibilium-dev \
|
||||
ncurses-dev \
|
||||
lua5.1 \
|
||||
lua5.1-dev \
|
||||
lua5.1-lpeg \
|
||||
lua5.1-mpack \
|
||||
lua5.1-busted \
|
||||
bash \
|
||||
git \
|
||||
grep \
|
||||
sed \
|
||||
python2 \
|
||||
python3 \
|
||||
py3-pip \
|
||||
gettext-dev \
|
||||
libuv-dev \
|
||||
libluv \
|
||||
lua-luv-dev \
|
||||
utf8proc-dev \
|
||||
vint \
|
||||
curl \
|
||||
gettext-dev \
|
||||
libtool \
|
||||
ninja \
|
||||
tree-sitter-dev \
|
||||
grep \
|
||||
sed \
|
||||
"
|
||||
|
||||
RUN apk --update add $PACKAGES && \
|
||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN adduser -h /home/vimtest -s /bin/sh -D -u 8465 vimtest
|
||||
RUN install_vim -tag v8.0.0027 -build \
|
||||
-tag v9.0.0297 -build \
|
||||
-tag neovim:v0.7.0 -build \
|
||||
-tag neovim:v0.8.0 -build
|
||||
|
||||
RUN mkdir -p /vim /vim-build/bin /plugins
|
||||
RUN chown vimtest:vimtest /home /plugins
|
||||
|
||||
# Useful during tests to have these packages in a deeper layer cached already.
|
||||
# RUN apk --no-cache add --virtual vim-build build-base
|
||||
|
||||
ADD docker/argecho.sh /vim-build/bin/argecho
|
||||
ADD docker/install_vim.sh /sbin/install_vim
|
||||
ADD docker/run_vim.sh /sbin/run_vim
|
||||
|
||||
RUN chmod +x /vim-build/bin/argecho /sbin/install_vim /sbin/run_vim
|
||||
|
||||
# The user directory for setup
|
||||
VOLUME /home/vimtest
|
||||
|
||||
# Your plugin
|
||||
VOLUME /testplugin
|
||||
|
||||
ENTRYPOINT ["/sbin/run_vim"]
|
||||
|
||||
#############################################################################
|
||||
# ALE Test image
|
||||
#
|
||||
FROM testbed
|
||||
|
||||
RUN install_vim -tag v8.2.5172 -build \
|
||||
-tag v9.2.0329 -build \
|
||||
-tag neovim:v0.10.4 -build \
|
||||
-tag neovim:v0.12.1 -build
|
||||
RUN pip install vim-vint==0.3.21
|
||||
|
||||
RUN git clone https://github.com/junegunn/vader.vim vader && \
|
||||
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Asynchronous Lint Engine
|
||||
|
||||
[](https://www.vim.org/) [](https://neovim.io/) [](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [](https://discord.gg/5zFD6pQxDk)
|
||||
[](https://www.vim.org/) [](https://neovim.io/) [](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [](https://ci.appveyor.com/project/dense-analysis/ale) [](https://discord.gg/5zFD6pQxDk)
|
||||
|
||||

|
||||
|
||||
ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
|
||||
and semantic errors) in Neovim 0.7.0+ and Vim 8.2+ while you edit your text files,
|
||||
and semantic errors) in Neovim 0.7.0+ and Vim 8.0+ while you edit your text files,
|
||||
and acts as a Vim [Language Server Protocol](https://langserver.org/) client.
|
||||
|
||||
<video autoplay="true" muted="true" loop="true" controls="false" src="https://user-images.githubusercontent.com/3518142/210141215-8f2ff760-6a87-4704-a11e-c109b8e9ec41.mp4" title="An example showing what ALE can do."></video>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
" Description: Language server for Debian package files
|
||||
|
||||
call ale#Set('autopkgtest_debian_lsp_executable', 'debian-lsp')
|
||||
|
||||
function! ale_linters#autopkgtest#debian_lsp#GetProjectRoot(buffer) abort
|
||||
" Find the debian directory
|
||||
let l:debian_dir = ale#path#FindNearestDirectory(a:buffer, 'debian')
|
||||
|
||||
if !empty(l:debian_dir)
|
||||
return fnamemodify(l:debian_dir, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('autopkgtest', {
|
||||
\ 'name': 'debian_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'autopkgtest_debian_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#autopkgtest#debian_lsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for c files
|
||||
|
||||
call ale#handlers#astgrep#Define('c')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for cpp files
|
||||
|
||||
call ale#handlers#astgrep#Define('cpp')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for cs files
|
||||
|
||||
call ale#handlers#astgrep#Define('cs')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for css files
|
||||
|
||||
call ale#handlers#astgrep#Define('css')
|
||||
@@ -23,7 +23,7 @@ function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\ 'filename': ale#path#Simplify(fnamemodify(l:match[1], ':p')),
|
||||
\ 'filename': fnamemodify(l:match[1], ':p'),
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
|
||||
@@ -87,9 +87,7 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||
" Matches patterns lines like the following:
|
||||
" /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this')
|
||||
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||
" Use [^(]+ instead of \f+ because NeoVim's 'isfname' on Windows does
|
||||
" not include \ or :, so \f+ cannot match Windows absolute paths.
|
||||
let l:pattern = '\v^([^(]+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
|
||||
let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
|
||||
let l:output = []
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
" Description: Language server for Debian package files
|
||||
|
||||
call ale#Set('debchangelog_debian_lsp_executable', 'debian-lsp')
|
||||
|
||||
function! ale_linters#debchangelog#debian_lsp#GetProjectRoot(buffer) abort
|
||||
" Find the debian directory
|
||||
let l:debian_dir = ale#path#FindNearestDirectory(a:buffer, 'debian')
|
||||
|
||||
if !empty(l:debian_dir)
|
||||
return fnamemodify(l:debian_dir, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('debchangelog', {
|
||||
\ 'name': 'debian_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'debchangelog_debian_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#debchangelog#debian_lsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
" Description: Language server for Debian package files
|
||||
|
||||
call ale#Set('debcontrol_debian_lsp_executable', 'debian-lsp')
|
||||
|
||||
function! ale_linters#debcontrol#debian_lsp#GetProjectRoot(buffer) abort
|
||||
" Find the debian directory
|
||||
let l:debian_dir = ale#path#FindNearestDirectory(a:buffer, 'debian')
|
||||
|
||||
if !empty(l:debian_dir)
|
||||
return fnamemodify(l:debian_dir, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('debcontrol', {
|
||||
\ 'name': 'debian_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'debcontrol_debian_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#debcontrol#debian_lsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
" Description: Language server for Debian package files
|
||||
|
||||
call ale#Set('debcopyright_debian_lsp_executable', 'debian-lsp')
|
||||
|
||||
function! ale_linters#debcopyright#debian_lsp#GetProjectRoot(buffer) abort
|
||||
" Find the debian directory
|
||||
let l:debian_dir = ale#path#FindNearestDirectory(a:buffer, 'debian')
|
||||
|
||||
if !empty(l:debian_dir)
|
||||
return fnamemodify(l:debian_dir, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('debcopyright', {
|
||||
\ 'name': 'debian_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'debcopyright_debian_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#debcopyright#debian_lsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
" Description: Language server for Debian package files
|
||||
|
||||
call ale#Set('debsources_debian_lsp_executable', 'debian-lsp')
|
||||
|
||||
function! ale_linters#debsources#debian_lsp#GetProjectRoot(buffer) abort
|
||||
" Find the debian directory
|
||||
let l:debian_dir = ale#path#FindNearestDirectory(a:buffer, 'debian')
|
||||
|
||||
if !empty(l:debian_dir)
|
||||
return fnamemodify(l:debian_dir, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('debsources', {
|
||||
\ 'name': 'debian_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'debsources_debian_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#debsources#debian_lsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
" Description: Language server for Debian package files
|
||||
|
||||
call ale#Set('debupstream_debian_lsp_executable', 'debian-lsp')
|
||||
|
||||
function! ale_linters#debupstream#debian_lsp#GetProjectRoot(buffer) abort
|
||||
" Find the debian directory
|
||||
let l:debian_dir = ale#path#FindNearestDirectory(a:buffer, 'debian')
|
||||
|
||||
if !empty(l:debian_dir)
|
||||
return fnamemodify(l:debian_dir, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('debupstream', {
|
||||
\ 'name': 'debian_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'debupstream_debian_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#debupstream#debian_lsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
" Description: Language server for Debian package files
|
||||
|
||||
call ale#Set('debwatch_debian_lsp_executable', 'debian-lsp')
|
||||
|
||||
function! ale_linters#debwatch#debian_lsp#GetProjectRoot(buffer) abort
|
||||
" Find the debian directory
|
||||
let l:debian_dir = ale#path#FindNearestDirectory(a:buffer, 'debian')
|
||||
|
||||
if !empty(l:debian_dir)
|
||||
return fnamemodify(l:debian_dir, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('debwatch', {
|
||||
\ 'name': 'debian_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'debwatch_debian_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#debwatch#debian_lsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for elixir files
|
||||
|
||||
call ale#handlers#astgrep#Define('elixir')
|
||||
@@ -7,6 +7,6 @@ call ale#linter#Define('elixir', {
|
||||
\ 'name': 'expert',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'elixir_expert_executable')},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||
\})
|
||||
+19
-62
@@ -1,88 +1,45 @@
|
||||
" Author: evnu - https://github.com/evnu
|
||||
" Author: colbydehart - https://github.com/colbydehart
|
||||
" Author: toupeira - https://github.com/toupeira
|
||||
" Description: Mix compile checking for Elixir files
|
||||
|
||||
function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
||||
" Example output from Elixir 1.20.0:
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" warning: variable "a" is unused (if the variable is not meant to be used, prefix it with an underscore)
|
||||
" │
|
||||
" 16 │ a = missing_var
|
||||
" │ ~
|
||||
" │
|
||||
" └─ lib/foo.ex:16:5: Foo.hello/0
|
||||
" Error format
|
||||
" ** (CompileError) apps/sim/lib/sim/server.ex:87: undefined function update_in/4
|
||||
"
|
||||
" warning: variable "b" is unused (if the variable is not meant to be used, prefix it with an underscore)
|
||||
" │
|
||||
" 17 │ b = another_missing_var
|
||||
" │ ~
|
||||
" │
|
||||
" └─ lib/foo.ex:17:5: Foo.hello/0
|
||||
"
|
||||
" error: undefined variable "another_missing_var"
|
||||
" │
|
||||
" 17 │ b = another_missing_var
|
||||
" │ ^^^^^^^^^^^^^^^^^^^
|
||||
" │
|
||||
" └─ lib/foo.ex:17:9: Foo.hello/0
|
||||
"
|
||||
" error: undefined variable "missing_var"
|
||||
" │
|
||||
" 16 │ a = missing_var
|
||||
" │ ^^^^^^^^^^^
|
||||
" │
|
||||
" └─ lib/foo.ex:16:9: Foo.hello/0
|
||||
"
|
||||
"
|
||||
" == Compilation error in file lib/foo.ex ==
|
||||
" ** (CompileError) lib/foo.ex: cannot compile module Foo (errors have been logged)
|
||||
"
|
||||
" NOTE: The line with the error class is not captured because it always
|
||||
" seems to be either a `CompileError` or a `SyntaxError`, with a generic
|
||||
" message.
|
||||
"
|
||||
let l:pattern_text = '\v^ (warning|error): (.+)$'
|
||||
let l:pattern_file = '\v^ └─ ([^ :]+):([0-9]+):([0-9]+)?'
|
||||
|
||||
let l:match_texts = ale#util#GetMatches(a:lines, l:pattern_text)
|
||||
let l:match_files = ale#util#GetMatches(a:lines, l:pattern_file)
|
||||
|
||||
" TODO: Warning format
|
||||
" warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name
|
||||
let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$'
|
||||
let l:output = []
|
||||
let l:index = 0
|
||||
|
||||
" Always add the full output as detail
|
||||
let l:detail = join(a:lines, "\n")
|
||||
|
||||
for l:match_text in l:match_texts
|
||||
let l:type = toupper(l:match_text[1][0])
|
||||
let l:match_file = get(l:match_files, l:index, [])
|
||||
|
||||
if !ale#path#IsBufferPath(a:buffer, get(l:match_file, 1))
|
||||
continue
|
||||
endif
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
let l:text = l:match[4]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': 0,
|
||||
\ 'type': l:type,
|
||||
\ 'detail': l:detail,
|
||||
\ 'text': get(l:match_text, 2, v:null),
|
||||
\ 'lnum': str2nr(get(l:match_file, 2, v:null)),
|
||||
\ 'col': str2nr(get(l:match_file, 3, v:null)),
|
||||
\ 'text': l:text,
|
||||
\})
|
||||
|
||||
let l:index += 1
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
|
||||
|
||||
return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'mix',
|
||||
\ 'executable': 'mix',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': '%e compile',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#elixir#mix#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elixir#mix#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -2,13 +2,13 @@
|
||||
" based on the ale ruumba and robocop linters
|
||||
" Description: ERB Lint, support for https://github.com/Shopify/erb-lint
|
||||
|
||||
call ale#Set('eruby_erblint_executable', 'erb_lint')
|
||||
call ale#Set('eruby_erblint_executable', 'erblint')
|
||||
call ale#Set('eruby_erblint_options', '')
|
||||
|
||||
function! ale_linters#eruby#erblint#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'erb_lint')
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
|
||||
\ . ' --format json '
|
||||
\ . ale#Var(a:buffer, 'eruby_erblint_options')
|
||||
\ . ' --stdin %s'
|
||||
|
||||
@@ -21,13 +21,9 @@ function! ale_linters#fortran#fortitude#Handle(buffer, lines) abort
|
||||
let l:prefix = matchstr(l:error['code'], '^\a\+')
|
||||
let l:type = get(s:severity_map, l:prefix, 'I')
|
||||
|
||||
" Fortitude renamed `row` to `line` (PlasmaFAIR/fortitude@0eda11975096517b16bf30bf683011f83a24e55e)
|
||||
let l:line = get(l:error['location'], 'line', get(l:error['location'], 'row'))
|
||||
let l:end_line = get(l:error['end_location'], 'line', get(l:error['end_location'], 'row'))
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'end_lnum': l:end_line,
|
||||
\ 'lnum': l:error['location']['row'],
|
||||
\ 'end_lnum': l:error['end_location']['row'],
|
||||
\ 'col': l:error['location']['column'],
|
||||
\ 'end_col': l:error['end_location']['column'],
|
||||
\ 'text': l:error['message'],
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for go files
|
||||
|
||||
call ale#handlers#astgrep#Define('go')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for haskell files
|
||||
|
||||
call ale#handlers#astgrep#Define('haskell')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for html files
|
||||
|
||||
call ale#handlers#astgrep#Define('html')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for java files
|
||||
|
||||
call ale#handlers#astgrep#Define('java')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for javascript files
|
||||
|
||||
call ale#handlers#astgrep#Define('javascript')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for json files
|
||||
|
||||
call ale#handlers#astgrep#Define('json')
|
||||
@@ -1,18 +0,0 @@
|
||||
" Author: Johan Larsson <johan@jolars.co>
|
||||
" Description: A language server, formatter, and linter for Julia
|
||||
|
||||
call ale#Set('julia_fatou_executable', 'fatou')
|
||||
|
||||
function! ale_linters#julia#fatou#GetProjectRoot(buffer) abort
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, 'fatou.toml')
|
||||
|
||||
return !empty(l:config) ? fnamemodify(l:config, ':h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('julia', {
|
||||
\ 'name': 'fatou',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'julia_fatou_executable')},
|
||||
\ 'command': '%e lsp',
|
||||
\ 'project_root': function('ale_linters#julia#fatou#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for kotlin files
|
||||
|
||||
call ale#handlers#astgrep#Define('kotlin')
|
||||
@@ -1,40 +0,0 @@
|
||||
" Author: Sam Bottoni
|
||||
" Description: lilypond linter for LilyPond files
|
||||
|
||||
call ale#Set('lilypond_lilypond_executable', 'lilypond')
|
||||
|
||||
let g:ale_lilypond_lilypond_options = get(g:, 'ale_lilypond_lilypond_options', '')
|
||||
|
||||
function! ale_linters#lilypond#lilypond#GetCommand(buffer) abort
|
||||
return '%e --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'lilypond_lilypond_options'))
|
||||
\ . ' %t 2>&1'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#lilypond#lilypond#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
" Match: file:line:col: error|warning|programming error: message
|
||||
let l:match = matchlist(l:line,
|
||||
\ '\v^.*:(\d+):(\d+): (error|warning|programming error): (.*)$')
|
||||
|
||||
if !empty(l:match)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4]
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('lilypond', {
|
||||
\ 'name': 'lilypond',
|
||||
\ 'executable': {b -> ale#Var(b, 'lilypond_lilypond_executable')},
|
||||
\ 'command': function('ale_linters#lilypond#lilypond#GetCommand'),
|
||||
\ 'callback': 'ale_linters#lilypond#lilypond#Handle',
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for lua files
|
||||
|
||||
call ale#handlers#astgrep#Define('lua')
|
||||
@@ -1,32 +0,0 @@
|
||||
" Author: Armand Halbert <armand.halbert@gmail.com>
|
||||
" Description: Harper for Markdown files
|
||||
|
||||
call ale#Set('markdown_harper_config', {
|
||||
\ 'harper-ls': {
|
||||
\ 'diagnosticSeverity': 'hint',
|
||||
\ 'dialect': 'American',
|
||||
\ 'linters': {
|
||||
\ 'SpellCheck': v:true,
|
||||
\ 'SentenceCapitalization': v:true,
|
||||
\ 'RepeatedWords': v:true,
|
||||
\ 'LongSentences': v:true,
|
||||
\ 'AnA': v:true,
|
||||
\ 'Spaces': v:true,
|
||||
\ 'SpelledNumbers': v:false,
|
||||
\ 'WrongQuotes': v:false,
|
||||
\ },
|
||||
\ },
|
||||
\})
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'harper',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'harper-ls',
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#markdown#harper#GetProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'markdown_harper_config')},
|
||||
\})
|
||||
|
||||
function! ale_linters#markdown#harper#GetProjectRoot(buffer) abort
|
||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
||||
endfunction
|
||||
@@ -1,29 +1,27 @@
|
||||
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
|
||||
" Description: Adds support for markdownlint-cli
|
||||
" Description: Adds support for markdownlint
|
||||
|
||||
call ale#Set('markdown_markdownlint_executable', 'markdownlint')
|
||||
call ale#Set('markdown_markdownlint_options', '')
|
||||
|
||||
function! ale_linters#markdown#markdownlint#GetExecutable(buffer) abort
|
||||
return ale#handlers#markdownlint#GetExecutable(
|
||||
\ a:buffer,
|
||||
\ 'markdownlint',
|
||||
\)
|
||||
return ale#Var(a:buffer, 'markdown_markdownlint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
|
||||
return ale#handlers#markdownlint#GetCommand(
|
||||
\ a:buffer,
|
||||
\ 'markdownlint',
|
||||
\)
|
||||
let l:executable = ale_linters#markdown#markdownlint#GetExecutable(a:buffer)
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'markdownlint_cli',
|
||||
\ 'aliases': ['markdownlint', 'markdownlint-cli'],
|
||||
\ 'name': 'markdownlint',
|
||||
\ 'executable': function('ale_linters#markdown#markdownlint#GetExecutable'),
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#markdownlint#Handle',
|
||||
\ 'callback': 'ale#handlers#markdownlint#Handle'
|
||||
\})
|
||||
@@ -1,29 +0,0 @@
|
||||
" Author: Horacio Sanson
|
||||
" Description: Adds support for markdownlint-cli2
|
||||
|
||||
call ale#Set('markdown_markdownlint_cli2_executable', 'markdownlint-cli2')
|
||||
call ale#Set('markdown_markdownlint_cli2_options', '')
|
||||
|
||||
function! ale_linters#markdown#markdownlint_cli2#GetExecutable(buffer) abort
|
||||
return ale#handlers#markdownlint#GetExecutable(
|
||||
\ a:buffer,
|
||||
\ 'markdownlint_cli2',
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#markdownlint_cli2#GetCommand(buffer) abort
|
||||
return ale#handlers#markdownlint#GetCommand(
|
||||
\ a:buffer,
|
||||
\ 'markdownlint_cli2',
|
||||
\)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'markdownlint_cli2',
|
||||
\ 'aliases': ['markdownlint-cli2'],
|
||||
\ 'executable': function('ale_linters#markdown#markdownlint_cli2#GetExecutable'),
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command': function('ale_linters#markdown#markdownlint_cli2#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#markdownlint#Handle',
|
||||
\})
|
||||
@@ -1,48 +0,0 @@
|
||||
" Author: Evan Chen <evan@evanchen.cc>
|
||||
" Description: Fast Markdown linter and formatter written in Rust
|
||||
|
||||
|
||||
call ale#Set('markdown_rumdl_executable', 'rumdl')
|
||||
call ale#Set('markdown_rumdl_options', '')
|
||||
|
||||
function! ale_linters#markdown#rumdl#GetProjectRoot(buffer) abort
|
||||
let l:dotconfig = ale#path#FindNearestFile(a:buffer, '.rumdl.toml')
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, 'rumdl.toml')
|
||||
|
||||
if !empty(l:dotconfig) && !empty(l:config)
|
||||
let l:nearest = len(l:dotconfig) >= len(l:config) ? l:dotconfig : l:config
|
||||
|
||||
return fnamemodify(l:nearest, ':h')
|
||||
elseif !empty(l:dotconfig)
|
||||
return fnamemodify(l:dotconfig, ':h')
|
||||
elseif !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
" Try to find nearest pyproject.toml
|
||||
let l:pyproject_file = ale#path#FindNearestFile(a:buffer, 'pyproject.toml')
|
||||
|
||||
if !empty(l:pyproject_file)
|
||||
return fnamemodify(l:pyproject_file . '/', ':p:h:h')
|
||||
endif
|
||||
|
||||
" Try to find nearest `git` directory
|
||||
let l:gitdir = ale#path#FindNearestFile(a:buffer, '.git')
|
||||
|
||||
if !empty(l:gitdir)
|
||||
return fnamemodify(l:gitdir . '/', ':p:h:h')
|
||||
endif
|
||||
|
||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'rumdl',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'markdown_rumdl_executable')},
|
||||
\ 'command': {b -> ale#Escape(ale#Var(b, 'markdown_rumdl_executable'))
|
||||
\ . ' server --stdio'
|
||||
\ . ale#Pad(ale#Var(b, 'markdown_rumdl_options'))},
|
||||
\ 'project_root': function('ale_linters#markdown#rumdl#GetProjectRoot'),
|
||||
\ 'language': 'markdown',
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for nix files
|
||||
|
||||
call ale#handlers#astgrep#Define('nix')
|
||||
@@ -1,23 +0,0 @@
|
||||
" 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'),
|
||||
\})
|
||||
@@ -5,6 +5,29 @@
|
||||
call ale#Set('perl_perl_executable', 'perl')
|
||||
" Please note that perl_perl_options does not exist here.
|
||||
|
||||
function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
|
||||
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
|
||||
" Build.PL, https://metacpan.org/pod/Module::Build
|
||||
" dist.ini, https://metacpan.org/pod/Dist::Zilla
|
||||
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini' ]
|
||||
|
||||
for l:root in l:potential_roots
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(l:project_root . '/', ':p:h:h')
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:project_root = ale#path#FindNearestFileOrDirectory(a:buffer, '.git')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(l:project_root . '/', ':p:h:h')
|
||||
endif
|
||||
|
||||
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
|
||||
endfunction
|
||||
|
||||
call ale#Set('perl_languageserver_config', {})
|
||||
|
||||
function! s:get_lsp_config(buffer) abort
|
||||
@@ -22,5 +45,5 @@ call ale#linter#Define('perl', {
|
||||
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
|
||||
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
|
||||
\ 'lsp_config': {b -> s:get_lsp_config(b)},
|
||||
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
|
||||
\ 'project_root': function('ale_linters#perl#languageserver#GetProjectRoot'),
|
||||
\ })
|
||||
@@ -1,15 +0,0 @@
|
||||
" Author: rymdbar <https://rymdbar.x20.se/>
|
||||
" Description: Perl Navigator Language Server
|
||||
" See: https://github.com/bscan/PerlNavigator
|
||||
|
||||
call ale#Set('perl_perlnavigator_config', {})
|
||||
call ale#Set('perl_perlnavigator_executable', 'perlnavigator')
|
||||
|
||||
call ale#linter#Define('perl', {
|
||||
\ 'name': 'perlnavigator',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'perl_perlnavigator_executable')},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'perl_perlnavigator_config')},
|
||||
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
|
||||
\ })
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for php files
|
||||
|
||||
call ale#handlers#astgrep#Define('php')
|
||||
@@ -7,34 +7,6 @@ call ale#Set('php_phpcs_options', '')
|
||||
call ale#Set('php_phpcs_executable', 'phpcs')
|
||||
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#php#phpcs#GetCwd(buffer) abort
|
||||
let l:result = ale#path#Dirname(ale_linters#php#phpcs#FindProjectRoot(a:buffer))
|
||||
|
||||
return empty(l:result) ? v:null : l:result
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#FindProjectRoot(buffer) abort
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, 'phpcs.xml')
|
||||
|
||||
if empty(l:result)
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, 'phpcs.xml.dist')
|
||||
endif
|
||||
|
||||
if empty(l:result)
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, '.phpcs.xml')
|
||||
endif
|
||||
|
||||
if empty(l:result)
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, '.phpcs.xml.dist')
|
||||
endif
|
||||
|
||||
if empty(l:result)
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, 'composer.json')
|
||||
endif
|
||||
|
||||
return l:result
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#GetCommand(buffer) abort
|
||||
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
|
||||
let l:standard_option = !empty(l:standard)
|
||||
@@ -76,7 +48,7 @@ call ale#linter#Define('php', {
|
||||
\ 'vendor/bin/phpcs',
|
||||
\ 'phpcs'
|
||||
\ ])},
|
||||
\ 'cwd': function('ale_linters#php#phpcs#GetCwd'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#php#phpcs#GetCommand'),
|
||||
\ 'callback': 'ale_linters#php#phpcs#Handle',
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for python files
|
||||
|
||||
call ale#handlers#astgrep#Define('python')
|
||||
@@ -6,7 +6,6 @@ call ale#Set('python_pyrefly_use_global', get(g:, 'ale_use_global_executables',
|
||||
call ale#Set('python_pyrefly_auto_pipenv', 0)
|
||||
call ale#Set('python_pyrefly_auto_poetry', 0)
|
||||
call ale#Set('python_pyrefly_auto_uv', 0)
|
||||
call ale#Set('python_pyrefly_config', {'python': {'pyrefly': {'displayTypeErrors': 'force-on'}}})
|
||||
|
||||
function! ale_linters#python#pyrefly#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyrefly_auto_pipenv'))
|
||||
@@ -55,5 +54,4 @@ call ale#linter#Define('python', {
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
\ 'cwd': function('ale_linters#python#pyrefly#GetCwd'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'python_pyrefly_config')},
|
||||
\})
|
||||
@@ -1,6 +1,5 @@
|
||||
call ale#Set('python_pyright_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pyright_executable', 'pyright-langserver')
|
||||
call ale#Set('python_pyright_options', '--stdio')
|
||||
call ale#Set('python_pyright_config', {})
|
||||
call ale#Set('python_pyright_auto_pipenv', 0)
|
||||
call ale#Set('python_pyright_auto_poetry', 0)
|
||||
@@ -80,8 +79,7 @@ function! ale_linters#python#pyright#GetCommand(buffer) abort
|
||||
let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
|
||||
endif
|
||||
|
||||
return l:env_string . ale#Escape(l:executable) . l:exec_args .
|
||||
\ ale#Pad(ale#Var(a:buffer, 'python_pyright_options'))
|
||||
return l:env_string . ale#Escape(l:executable) . l:exec_args . ' --stdio'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
|
||||
@@ -8,7 +8,6 @@ call ale#Set('python_ruff_change_directory', 1)
|
||||
call ale#Set('python_ruff_auto_pipenv', 0)
|
||||
call ale#Set('python_ruff_auto_poetry', 0)
|
||||
call ale#Set('python_ruff_auto_uv', 0)
|
||||
call ale#Set('python_ruff_human_readable', 0)
|
||||
|
||||
call ale#fix#registry#Add('ruff',
|
||||
\ 'ale#fixers#ruff#Fix',
|
||||
@@ -114,7 +113,7 @@ function! ale_linters#python#ruff#Handle(buffer, lines) abort
|
||||
\ 'col': l:item.location.column,
|
||||
\ 'end_lnum': l:item.end_location.row,
|
||||
\ 'end_col': l:item.end_location.column - 1,
|
||||
\ 'code': ale#Var(a:buffer, 'python_ruff_human_readable') ? l:item.name : l:item.code,
|
||||
\ 'code': l:item.code,
|
||||
\ 'text': l:item.message,
|
||||
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
|
||||
\})
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
" Author: w0rp <dev@w0rp.com>
|
||||
" Description: Astral's Python type checker and language server
|
||||
|
||||
call ale#Set('python_ty_executable', 'ty')
|
||||
call ale#Set('python_ty_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_ty_auto_pipenv', 0)
|
||||
call ale#Set('python_ty_auto_poetry', 0)
|
||||
call ale#Set('python_ty_auto_uv', 0)
|
||||
call ale#Set('python_ty_config', {})
|
||||
|
||||
function! ale_linters#python#ty#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_ty_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_ty_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ty_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_ty', ['ty'])
|
||||
endfunction
|
||||
|
||||
" Force the cwd of the server to be the same as the project root.
|
||||
function! ale_linters#python#ty#GetCwd(buffer) abort
|
||||
let l:fake_linter = {
|
||||
\ 'name': 'ty',
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\}
|
||||
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
|
||||
|
||||
return !empty(l:root) ? l:root : v:null
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#ty#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#ty#GetExecutable(a:buffer)
|
||||
let l:exec_args = [
|
||||
\ ale#Escape(l:executable),
|
||||
\]
|
||||
\ + (l:executable =~? '\(pipenv\|poetry\|uv\)$' ? ['run', 'ty'] : [])
|
||||
\ + [
|
||||
\ 'server',
|
||||
\]
|
||||
|
||||
return join(l:exec_args, ' ')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'ty',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#python#ty#GetExecutable'),
|
||||
\ 'cwd': function('ale_linters#python#ty#GetCwd'),
|
||||
\ 'command': function('ale_linters#python#ty#GetCommand'),
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'python_ty_config')},
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for ruby files
|
||||
|
||||
call ale#handlers#astgrep#Define('ruby')
|
||||
@@ -8,10 +8,7 @@ call ale#Set('ruby_solargraph_executable', 'solargraph')
|
||||
call ale#Set('ruby_solargraph_options', {})
|
||||
|
||||
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_solargraph_executable')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'solargraph')
|
||||
\ . ale#Pad('stdio')
|
||||
return '%e' . ale#Pad('stdio')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for rust files
|
||||
|
||||
call ale#handlers#astgrep#Define('rust')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for scala files
|
||||
|
||||
call ale#handlers#astgrep#Define('scala')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for sh files
|
||||
|
||||
call ale#handlers#astgrep#Define('sh')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for solidity files
|
||||
|
||||
call ale#handlers#astgrep#Define('solidity')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for swift files
|
||||
|
||||
call ale#handlers#astgrep#Define('swift')
|
||||
@@ -25,10 +25,6 @@ endfunction
|
||||
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
|
||||
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
|
||||
|
||||
if empty(l:tf_dir)
|
||||
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.')
|
||||
endif
|
||||
|
||||
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
" Description: trivy for Terraform files
|
||||
"
|
||||
" See: https://www.terraform.io/
|
||||
" https://github.com/aquasecurity/trivy
|
||||
|
||||
call ale#Set('terraform_trivy_options', '')
|
||||
call ale#Set('terraform_trivy_executable', 'trivy')
|
||||
|
||||
function! ale_linters#terraform#trivy#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
|
||||
if empty(get(l:json, 'Results'))
|
||||
return l:output
|
||||
endif
|
||||
|
||||
let l:fname = expand('#' . a:buffer . ':t')
|
||||
|
||||
for l:result in get(l:json, 'Results', [])
|
||||
for l:misconfig in get(l:result, 'Misconfigurations', [])
|
||||
let l:severity = get(l:misconfig, 'Severity', 'MEDIUM')
|
||||
|
||||
if l:severity is# 'LOW'
|
||||
let l:type = 'I'
|
||||
elseif l:severity is# 'CRITICAL' || l:severity is# 'HIGH'
|
||||
let l:type = 'E'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
let l:cause = get(l:misconfig, 'CauseMetadata', {})
|
||||
let l:title = get(l:misconfig, 'Title', '')
|
||||
let l:id = get(l:misconfig, 'ID', '')
|
||||
let l:desc = get(l:misconfig, 'Description', '')
|
||||
|
||||
" Module findings store the location in the caller's file
|
||||
" in CauseMetadata.Occurrences. Use those when available.
|
||||
let l:occurrences = get(l:cause, 'Occurrences', [])
|
||||
|
||||
if !empty(l:occurrences)
|
||||
for l:occurrence in l:occurrences
|
||||
if get(l:occurrence, 'Filename', '') is# l:fname
|
||||
let l:loc = get(l:occurrence, 'Location', {})
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': get(l:loc, 'StartLine', 1),
|
||||
\ 'end_lnum': get(l:loc, 'EndLine', get(l:loc, 'StartLine', 1)),
|
||||
\ 'text': l:title . ' [' . l:id . ']',
|
||||
\ 'detail': l:id . ': ' . l:title . "\n" . l:desc,
|
||||
\ 'code': l:id,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
elseif get(l:result, 'Target', '') is# l:fname
|
||||
call add(l:output, {
|
||||
\ 'lnum': get(l:cause, 'StartLine', 1),
|
||||
\ 'end_lnum': get(l:cause, 'EndLine', get(l:cause, 'StartLine', 1)),
|
||||
\ 'text': l:title . ' [' . l:id . ']',
|
||||
\ 'detail': l:id . ': ' . l:title . "\n" . l:desc,
|
||||
\ 'code': l:id,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
" Construct command arguments to trivy with `terraform_trivy_options`.
|
||||
function! ale_linters#terraform#trivy#GetCommand(buffer) abort
|
||||
let l:cmd = '%e config --format json'
|
||||
|
||||
let l:opts = ale#Var(a:buffer, 'terraform_trivy_options')
|
||||
|
||||
if !empty(l:opts)
|
||||
let l:cmd .= ' ' . l:opts
|
||||
endif
|
||||
|
||||
let l:cmd .= ' .'
|
||||
|
||||
return l:cmd
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('terraform', {
|
||||
\ 'name': 'trivy',
|
||||
\ 'executable': {b -> ale#Var(b, 'terraform_trivy_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#terraform#trivy#GetCommand'),
|
||||
\ 'callback': 'ale_linters#terraform#trivy#Handle',
|
||||
\})
|
||||
@@ -12,9 +12,7 @@ function! ale_linters#tex#chktex#GetCommand(buffer, version) abort
|
||||
let l:options = ''
|
||||
|
||||
" Avoid bug when used without -p (last warning has gibberish for a filename)
|
||||
" Do not use -v0 as the meaning of v0 might be modified by the user in
|
||||
" their chktexrc file; instead, use --format to specify the output format.
|
||||
let l:options .= " --format $'%f%b%l%b%c%b%n%b%m\n' -p stdin -q"
|
||||
let l:options .= ' -v0 -p stdin -q'
|
||||
|
||||
" Avoid bug of reporting wrong column when using tabs (issue #723)
|
||||
if ale#semver#GTE(a:version, [1, 7, 7])
|
||||
@@ -45,8 +43,7 @@ function! ale_linters#tex#chktex#Handle(buffer, lines) abort
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'code': l:match[3] + 0,
|
||||
\ 'text': l:match[4] . ' (' . (l:match[3]+0) . ')',
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for tsx files
|
||||
|
||||
call ale#handlers#astgrep#Define('tsx')
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for typescript files
|
||||
|
||||
call ale#handlers#astgrep#Define('typescript')
|
||||
@@ -58,7 +58,7 @@ call ale#linter#Define('vim', {
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale#Var(buffer, 'vim_vint_executable'),
|
||||
\ 'PYTHONWARNINGS=ignore %e --version',
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#vim#vint#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#vim#vint#Handle',
|
||||
|
||||
@@ -5,8 +5,8 @@ call ale#Set('yaml_actionlint_executable', 'actionlint')
|
||||
call ale#Set('yaml_actionlint_options', '')
|
||||
|
||||
function! ale_linters#yaml#actionlint#GetCommand(buffer) abort
|
||||
" Only execute actionlint on YAML files in /.github/workflows/ paths.
|
||||
if expand('#' . a:buffer . ':p') !~# '\v[/\\]\.github[/\\]workflows[/\\]'
|
||||
" Only execute actionlint on YAML files in /.github/ paths.
|
||||
if expand('#' . a:buffer . ':p') !~# '\v[/\\]\.github[/\\]'
|
||||
return ''
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ben Boeckel <github@me.benboeckel.net>
|
||||
" Description: astgrep for yaml files
|
||||
|
||||
call ale#handlers#astgrep#Define('yaml')
|
||||
+28
-37
@@ -5,13 +5,12 @@ call ale#Set('c_parse_makefile', 0)
|
||||
call ale#Set('c_always_make', has('unix') && !has('macunix'))
|
||||
call ale#Set('c_parse_compile_commands', 1)
|
||||
|
||||
let s:is_windows = has('win32') || has('win64') || has('win32unix')
|
||||
let s:sep = s:is_windows ? '\' : '/'
|
||||
let s:sep = has('win32') ? '\' : '/'
|
||||
|
||||
" Set just so tests can override it.
|
||||
let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt']
|
||||
|
||||
call ale#Set('c_build_dir_names', [
|
||||
let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
|
||||
\ 'build',
|
||||
\ 'build/Debug',
|
||||
\ 'build/Release',
|
||||
@@ -19,6 +18,10 @@ call ale#Set('c_build_dir_names', [
|
||||
\])
|
||||
|
||||
function! s:CanParseMakefile(buffer) abort
|
||||
" Something somewhere seems to delete this setting in tests, so ensure we
|
||||
" always have a default value.
|
||||
call ale#Set('c_parse_makefile', 0)
|
||||
|
||||
return ale#Var(a:buffer, 'c_parse_makefile')
|
||||
endfunction
|
||||
|
||||
@@ -243,6 +246,15 @@ function! ale#c#FindCompileCommands(buffer) abort
|
||||
return [fnamemodify(l:json_file, ':h'), l:json_file]
|
||||
endif
|
||||
|
||||
" Something somewhere seems to delete this setting in tests, so ensure
|
||||
" we always have a default value.
|
||||
call ale#Set('c_build_dir_names', [
|
||||
\ 'build',
|
||||
\ 'build/Debug',
|
||||
\ 'build/Release',
|
||||
\ 'bin',
|
||||
\])
|
||||
|
||||
" Search in build directories if we can't find it in the project.
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')
|
||||
@@ -387,40 +399,23 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
|
||||
let l:file_list = get(a:file_lookup, l:buffer_filename, [])
|
||||
|
||||
" We may have to look for /foo/bar instead of C:\foo\bar
|
||||
if empty(l:file_list) && s:is_windows
|
||||
" Try without the drive letter.
|
||||
let l:no_drive = ale#path#RemoveDriveLetter(l:buffer_filename)
|
||||
|
||||
let l:file_list = get(a:file_lookup, l:no_drive, [])
|
||||
|
||||
" Also try by iterating keys in case Simplify produced different
|
||||
" results for the key and the lookup value.
|
||||
if empty(l:file_list)
|
||||
for [l:key, l:val] in items(a:file_lookup)
|
||||
if ale#path#RemoveDriveLetter(l:key) is? l:no_drive
|
||||
let l:file_list = l:val
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
if empty(l:file_list) && has('win32')
|
||||
let l:file_list = get(
|
||||
\ a:file_lookup,
|
||||
\ ale#path#RemoveDriveLetter(l:buffer_filename),
|
||||
\ []
|
||||
\)
|
||||
endif
|
||||
|
||||
" Try the absolute path to the directory second.
|
||||
let l:dir_list = get(a:dir_lookup, l:dir, [])
|
||||
|
||||
if empty(l:dir_list) && s:is_windows
|
||||
let l:no_drive_dir = ale#path#RemoveDriveLetter(l:dir)
|
||||
|
||||
let l:dir_list = get(a:dir_lookup, l:no_drive_dir, [])
|
||||
|
||||
if empty(l:dir_list)
|
||||
for [l:key, l:val] in items(a:dir_lookup)
|
||||
if ale#path#RemoveDriveLetter(l:key) is? l:no_drive_dir
|
||||
let l:dir_list = l:val
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
if empty(l:dir_list) && has('win32')
|
||||
let l:dir_list = get(
|
||||
\ a:dir_lookup,
|
||||
\ ale#path#RemoveDriveLetter(l:dir),
|
||||
\ []
|
||||
\)
|
||||
endif
|
||||
|
||||
if empty(l:file_list) && empty(l:dir_list)
|
||||
@@ -442,7 +437,7 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
|
||||
let l:key = fnamemodify(l:buffer_filename, ':r') . l:suffix
|
||||
let l:file_list = get(a:file_lookup, l:key, [])
|
||||
|
||||
if empty(l:file_list) && s:is_windows
|
||||
if empty(l:file_list) && has('win32')
|
||||
let l:file_list = get(
|
||||
\ a:file_lookup,
|
||||
\ ale#path#RemoveDriveLetter(l:key),
|
||||
@@ -468,12 +463,8 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
|
||||
|
||||
" Load the flags for this file, or for a source file matching the
|
||||
" header file.
|
||||
" On Windows, bufnr() may fail to match when one path has a drive
|
||||
" letter and the other doesn't, so fall back to path comparison.
|
||||
if (
|
||||
\ bufnr(l:filename) is a:buffer
|
||||
\ || ale#path#RemoveDriveLetter(l:filename)
|
||||
\ is? ale#path#RemoveDriveLetter(l:buffer_filename)
|
||||
\ || (
|
||||
\ !empty(l:source_file)
|
||||
\ && l:filename[-len(l:source_file):] is? l:source_file
|
||||
|
||||
@@ -7,8 +7,6 @@ if !exists('s:buffer_data')
|
||||
let s:buffer_data = {}
|
||||
endif
|
||||
|
||||
let s:is_windows = has('win32') || has('win64') || has('win32unix')
|
||||
|
||||
" The regular expression used for formatting filenames with modifiers.
|
||||
let s:path_format_regex = '\v\%s(%(:h|:t|:r|:e)*)'
|
||||
|
||||
@@ -142,7 +140,7 @@ function! s:TemporaryFilename(buffer) abort
|
||||
|
||||
" Create a temporary filename, <temp_dir>/<original_basename>
|
||||
" The file itself will not be created by this function.
|
||||
return ale#path#GetAbsPath(ale#util#Tempname(), l:filename)
|
||||
return ale#util#Tempname() . (has('win32') ? '\' : '/') . l:filename
|
||||
endfunction
|
||||
|
||||
" Given part of a command, replace any % with %%, so that no characters in
|
||||
@@ -180,7 +178,7 @@ function! ale#command#CdString(directory) abort
|
||||
\ ? a:directory
|
||||
\ : ale#Escape(a:directory)
|
||||
|
||||
if s:is_windows
|
||||
if has('win32')
|
||||
return 'cd /d ' . l:directory . ' && '
|
||||
endif
|
||||
|
||||
@@ -394,7 +392,7 @@ function! ale#command#Run(buffer, command, Callback, ...) abort
|
||||
let s:fake_job_id = get(s:, 'fake_job_id', 0) + 1
|
||||
let l:job_id = s:fake_job_id
|
||||
endif
|
||||
elseif s:is_windows
|
||||
elseif has('win32')
|
||||
let l:job_id = ale#job#StartWithCmd(l:command, l:job_options)
|
||||
else
|
||||
let l:job_id = ale#job#Start(l:command, l:job_options)
|
||||
|
||||
@@ -145,7 +145,6 @@ let s:omni_start_map = {
|
||||
|
||||
" A map of exact characters for triggering LSP completions. Do not forget to
|
||||
" update self.input_patterns in ale.py in updating entries in this map.
|
||||
" These are used as a fallback when LSP servers don't provide trigger chars.
|
||||
let s:trigger_character_map = {
|
||||
\ '<default>': ['.'],
|
||||
\ 'typescript': ['.', '''', '"'],
|
||||
@@ -154,19 +153,6 @@ let s:trigger_character_map = {
|
||||
\ 'c': ['.', '->'],
|
||||
\}
|
||||
|
||||
" Get trigger characters, preferring LSP-provided ones over hardcoded.
|
||||
function! s:GetTriggerCharacters(filetype, conn_id) abort
|
||||
if !empty(a:conn_id)
|
||||
let l:lsp_triggers = ale#lsp#GetCompletionTriggerCharacters(a:conn_id)
|
||||
|
||||
if !empty(l:lsp_triggers)
|
||||
return l:lsp_triggers
|
||||
endif
|
||||
endif
|
||||
|
||||
return s:GetFiletypeValue(s:trigger_character_map, a:filetype)
|
||||
endfunction
|
||||
|
||||
function! s:GetFiletypeValue(map, filetype) abort
|
||||
for l:part in reverse(split(a:filetype, '\.'))
|
||||
let l:regex = get(a:map, l:part, [])
|
||||
@@ -189,32 +175,15 @@ function! ale#completion#GetPrefix(filetype, line, column) abort
|
||||
" abc
|
||||
" ^
|
||||
" So we need check the text in the column before that position.
|
||||
let l:line_text = getline(a:line)[: a:column - 2]
|
||||
let l:prefix = matchstr(l:line_text, l:regex)
|
||||
|
||||
if !empty(l:prefix)
|
||||
return l:prefix
|
||||
endif
|
||||
|
||||
" Check LSP trigger characters for active connections on this buffer.
|
||||
let l:triggers = ale#lsp#GetAllCompletionTriggerCharactersForBuffer(bufnr(''))
|
||||
|
||||
for l:char in l:triggers
|
||||
if l:line_text[-len(l:char):] is# l:char
|
||||
return l:char
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
return matchstr(getline(a:line)[: a:column - 2], l:regex)
|
||||
endfunction
|
||||
|
||||
function! ale#completion#GetTriggerCharacter(filetype, prefix, ...) abort
|
||||
function! ale#completion#GetTriggerCharacter(filetype, prefix) abort
|
||||
if empty(a:prefix)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:conn_id = get(a:, 1, '')
|
||||
let l:char_list = s:GetTriggerCharacters(a:filetype, l:conn_id)
|
||||
let l:char_list = s:GetFiletypeValue(s:trigger_character_map, a:filetype)
|
||||
|
||||
if index(l:char_list, a:prefix) >= 0
|
||||
return a:prefix
|
||||
@@ -235,8 +204,7 @@ function! ale#completion#Filter(
|
||||
if empty(a:prefix)
|
||||
let l:filtered_suggestions = a:suggestions
|
||||
else
|
||||
let l:conn_id = get(get(b:, 'ale_completion_info', {}), 'conn_id', '')
|
||||
let l:triggers = s:GetTriggerCharacters(a:filetype, l:conn_id)
|
||||
let l:triggers = s:GetFiletypeValue(s:trigger_character_map, a:filetype)
|
||||
|
||||
" For completing...
|
||||
" foo.
|
||||
@@ -796,9 +764,6 @@ function! s:OnReady(linter, lsp_details) abort
|
||||
let l:id = a:lsp_details.connection_id
|
||||
|
||||
if !ale#lsp#HasCapability(l:id, 'completion')
|
||||
" Return at least an empty result to avoid OmniFunc timeout
|
||||
call ale#completion#Show([])
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -837,7 +802,7 @@ function! s:OnReady(linter, lsp_details) abort
|
||||
\ l:buffer,
|
||||
\ b:ale_completion_info.line,
|
||||
\ b:ale_completion_info.column,
|
||||
\ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix, l:id),
|
||||
\ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix),
|
||||
\)
|
||||
endif
|
||||
|
||||
@@ -980,18 +945,9 @@ function! ale#completion#OmniFunc(findstart, base) abort
|
||||
else
|
||||
let l:result = ale#completion#GetCompletionResult()
|
||||
|
||||
let l:timeout = get(g:, 'ale_completion_timeout', 3)
|
||||
let l:timeout_start = reltime()
|
||||
|
||||
while l:result is v:null && !complete_check()
|
||||
sleep 2ms
|
||||
let l:result = ale#completion#GetCompletionResult()
|
||||
|
||||
if reltimefloat(reltime(l:timeout_start)) > l:timeout
|
||||
" no-custom-checks
|
||||
echoerr 'no result within timeout (' . l:timeout . 's)'
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return l:result isnot v:null ? l:result : []
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Logic for handling mappings between files
|
||||
|
||||
let s:is_windows = has('win32') || has('win64') || has('win32unix')
|
||||
|
||||
" Invert filesystem mappings so they can be mapped in reverse.
|
||||
function! ale#filename_mapping#Invert(filename_mappings) abort
|
||||
return map(copy(a:filename_mappings), '[v:val[1], v:val[0]]')
|
||||
@@ -16,16 +14,7 @@ function! ale#filename_mapping#Map(filename, filename_mappings) abort
|
||||
let l:mapping_from = ale#path#Simplify(l:mapping_from)
|
||||
|
||||
if l:simplified_filename[:len(l:mapping_from) - 1] is# l:mapping_from
|
||||
let l:suffix = l:simplified_filename[len(l:mapping_from):]
|
||||
|
||||
" On Windows, the simplified suffix uses backslashes, but the
|
||||
" mapping target may use forward slashes for a remote path.
|
||||
" Normalize the suffix separator to match the mapping target.
|
||||
if s:is_windows && l:mapping_to =~# '/'
|
||||
let l:suffix = substitute(l:suffix, '\\', '/', 'g')
|
||||
endif
|
||||
|
||||
return l:mapping_to . l:suffix
|
||||
return l:mapping_to . l:simplified_filename[len(l:mapping_from):]
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
||||
@@ -22,11 +22,6 @@ 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'],
|
||||
@@ -124,11 +119,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['erlang'],
|
||||
\ 'description': 'Format Erlang code with erlfmt',
|
||||
\ },
|
||||
\ 'fatou': {
|
||||
\ 'function': 'ale#fixers#fatou#Fix',
|
||||
\ 'suggested_filetypes': ['julia'],
|
||||
\ 'description': 'Format Julia files with fatou.',
|
||||
\ },
|
||||
\ 'fecs': {
|
||||
\ 'function': 'ale#fixers#fecs#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
|
||||
@@ -217,11 +207,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['puppet'],
|
||||
\ 'description': 'Run puppet-lint -f on a file.',
|
||||
\ },
|
||||
\ 'replace_emdash': {
|
||||
\ 'function': 'ale#fixers#generic#ReplaceEmDash',
|
||||
\ 'suggested_filetypes': [],
|
||||
\ 'description': 'Replace em dash with -- ASCII characters.',
|
||||
\ },
|
||||
\ 'remove_trailing_lines': {
|
||||
\ 'function': 'ale#fixers#generic#RemoveTrailingBlankLines',
|
||||
\ 'suggested_filetypes': [],
|
||||
@@ -472,11 +457,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with pandoc.',
|
||||
\ },
|
||||
\ 'mdformat': {
|
||||
\ 'function': 'ale#fixers#mdformat#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix Markdown files with mdformat.',
|
||||
\ },
|
||||
\ 'pymarkdown': {
|
||||
\ 'function': 'ale#fixers#pymarkdown#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
@@ -649,7 +629,7 @@ let s:default_registry = {
|
||||
\ },
|
||||
\ 'dprint': {
|
||||
\ 'function': 'ale#fixers#dprint#Fix',
|
||||
\ 'suggested_filetypes': ['astro', 'cs', 'css', 'dockerfile', 'go', 'graphql', 'html', 'javascript', 'jinja', 'json', 'less', 'markdown', 'mustache', 'nunjucks', 'php', 'python', 'sass', 'scss', 'sql', 'svelte', 'toml', 'twig', 'typescript', 'vento', 'vue', 'xml', 'yaml'],
|
||||
\ 'suggested_filetypes': ['dockerfile', 'javascript', 'json', 'markdown', 'toml', 'typescript'],
|
||||
\ 'description': 'Pluggable and configurable code formatting platform',
|
||||
\ },
|
||||
\ 'stylua': {
|
||||
@@ -752,11 +732,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['clojure'],
|
||||
\ 'description': 'formatter and linter for clojure files',
|
||||
\ },
|
||||
\ 'janet-format': {
|
||||
\ 'function': 'ale#fixers#janet_format#Fix',
|
||||
\ 'suggested_filetypes': ['janet'],
|
||||
\ 'description': 'Formatter for janet files',
|
||||
\ },
|
||||
\ 'typstyle': {
|
||||
\ 'function': 'ale#fixers#typstyle#Fix',
|
||||
\ 'suggested_filetypes': ['typst'],
|
||||
@@ -787,27 +762,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['verilog'],
|
||||
\ 'description': 'Formats verilog files using verible.',
|
||||
\ },
|
||||
\ 'markdownlint-cli': {
|
||||
\ 'markdownlint': {
|
||||
\ 'function': 'ale#fixers#markdownlint#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with markdownlint-cli.',
|
||||
\ 'aliases': ['markdownlint'],
|
||||
\ 'description': 'Fix markdown files with markdownlint.',
|
||||
\ },
|
||||
\ 'markdownlint-cli2': {
|
||||
\ 'function': 'ale#fixers#markdownlint_cli2#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with markdownlint-cli2.',
|
||||
\ },
|
||||
\ 'rumdl': {
|
||||
\ 'function': 'ale#fixers#rumdl#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with rumdl.',
|
||||
\ },
|
||||
\ 'tex-fmt': {
|
||||
\ 'function': 'ale#fixers#tex_fmt#Fix',
|
||||
\ 'suggested_filetypes': ['bib', 'tex'],
|
||||
\ 'description': 'Fix LaTeX and bibliography files with tex-fmt.',
|
||||
\ }
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
@@ -7,7 +7,7 @@ function! ale#fixers#alejandra#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' -- -'
|
||||
\}
|
||||
endfunction
|
||||
@@ -12,7 +12,7 @@ function! ale#fixers#apkbuild_fixer#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable')
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
" 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
|
||||
@@ -36,7 +36,7 @@ function! ale#fixers#clangtidy#GetCommand(buffer) abort
|
||||
|
||||
return ' -fix' . (l:fix_errors ? ' -fix-errors' : '')
|
||||
\ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks))
|
||||
\ . ale#Pad(l:extra_options)
|
||||
\ . (empty(l:extra_options) ? '' : ' ' . l:extra_options)
|
||||
\ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir))
|
||||
\ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options)
|
||||
endfunction
|
||||
|
||||
@@ -10,7 +10,7 @@ function! ale#fixers#cmakeformat#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' -'
|
||||
\}
|
||||
endfunction
|
||||
@@ -11,7 +11,7 @@ function! ale#fixers#dart_format#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale#fixers#dartfmt#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -w'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale#fixers#dfmt#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -i'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale#fixers#dotnet_format#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --folder --include %t "$(dirname %t)"',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -11,6 +11,6 @@ function! ale#fixers#dune#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . ale#Pad(l:options),
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
||||
\}
|
||||
endfunction
|
||||
@@ -17,7 +17,7 @@ function! ale#fixers#elm_format#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer))
|
||||
\ . ' %t'
|
||||
\ . ale#Pad(l:options),
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
@@ -1,15 +0,0 @@
|
||||
" Author: Johan Larsson <johan@jolars.co>
|
||||
" Description: Format Julia files with fatou.
|
||||
|
||||
call ale#Set('julia_fatou_executable', 'fatou')
|
||||
call ale#Set('julia_fatou_options', '')
|
||||
|
||||
function! ale#fixers#fatou#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'julia_fatou_executable')
|
||||
let l:options = ale#Var(a:buffer, 'julia_fatou_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' format'
|
||||
\ . ale#Pad(l:options),
|
||||
\}
|
||||
endfunction
|
||||
@@ -12,7 +12,7 @@ function! ale#fixers#fish_indent#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -w '
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -13,7 +13,7 @@ function! ale#fixers#fourmolu#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': l:executable
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --stdin-input-file '
|
||||
\ . ale#Escape(@%),
|
||||
\}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic functions for fixing files with.
|
||||
|
||||
function! ale#fixers#generic#ReplaceEmDash(buffer, lines) abort
|
||||
return map(copy(a:lines), {_, line -> substitute(line, "\u2014", '--', 'g')})
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort
|
||||
let l:end_index = len(a:lines) - 1
|
||||
|
||||
|
||||
@@ -11,6 +11,6 @@ function! ale#fixers#gofmt#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': l:env . ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
@@ -16,7 +16,7 @@ function! ale#fixers#goimports#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': l:env . ale#Escape(l:executable)
|
||||
\ . ' -l -w -srcdir %s'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -16,6 +16,6 @@ function! ale#fixers#golines#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': l:env . ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
@@ -15,7 +15,7 @@ function! ale#fixers#google_java_format#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . ale#Pad(l:options)
|
||||
\ . ' ' . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --replace'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale#fixers#hackfmt#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -i'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
" Author: David Gouch <dgouch@gmail.com>
|
||||
" Description: Format with janet-format https://github.com/janet-lang/spork
|
||||
|
||||
call ale#Set('janet_janet_format_executable', 'janet-format')
|
||||
|
||||
function! ale#fixers#janet_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'janet_janet_format_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
@@ -11,6 +11,6 @@ function! ale#fixers#latexindent#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -l'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
@@ -7,7 +7,7 @@ function! ale#fixers#luafmt#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --stdin',
|
||||
\}
|
||||
endfunction
|
||||
@@ -1,22 +1,15 @@
|
||||
:scriptencoding utf-8
|
||||
|
||||
call ale#Set('markdownlint_executable', 'markdownlint')
|
||||
call ale#Set('markdownlint_options', '')
|
||||
call ale#Set('markdownlint_options', '--fix')
|
||||
|
||||
function! ale#fixers#markdownlint#FixFor(buffer, name) abort
|
||||
let l:executable = ale#Var(a:buffer, a:name . '_executable')
|
||||
let l:options = ale#Var(a:buffer, a:name . '_options')
|
||||
function! ale#fixers#markdownlint#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'markdownlint_executable')
|
||||
let l:options = ale#Var(a:buffer, 'markdownlint_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' --fix'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ . ' ' . l:options,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#markdownlint#Fix(buffer) abort
|
||||
return ale#fixers#markdownlint#FixFor(a:buffer, 'markdownlint')
|
||||
endfunction
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
:scriptencoding utf-8
|
||||
" Author: Horacio Sanson
|
||||
" Description: Fixes Markdown files with markdownlint-cli2
|
||||
|
||||
call ale#Set('markdownlint_cli2_executable', 'markdownlint-cli2')
|
||||
call ale#Set('markdownlint_cli2_options', '')
|
||||
|
||||
function! ale#fixers#markdownlint_cli2#Fix(buffer) abort
|
||||
return ale#fixers#markdownlint#FixFor(a:buffer, 'markdownlint_cli2')
|
||||
endfunction
|
||||
@@ -1,43 +0,0 @@
|
||||
" Author: Horacio
|
||||
" Description: Fix Markdown files with mdformat.
|
||||
|
||||
call ale#Set('markdown_mdformat_executable', 'mdformat')
|
||||
call ale#Set('markdown_mdformat_options', '')
|
||||
call ale#Set('markdown_mdformat_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('markdown_mdformat_auto_pipenv', 0)
|
||||
call ale#Set('markdown_mdformat_auto_poetry', 0)
|
||||
call ale#Set('markdown_mdformat_auto_uv', 0)
|
||||
|
||||
function! ale#fixers#mdformat#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'markdown_mdformat_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'markdown_mdformat_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'markdown_mdformat_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'markdown_mdformat', ['mdformat'])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#mdformat#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#mdformat#GetExecutable(a:buffer)
|
||||
let l:command = ale#Escape(l:executable)
|
||||
|
||||
if l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
let l:command .= ' run mdformat'
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': l:command
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'markdown_mdformat_options'))
|
||||
\ . ' -',
|
||||
\}
|
||||
endfunction
|
||||
@@ -10,7 +10,7 @@ function! ale#fixers#nickel_format#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' format'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -7,6 +7,6 @@ function! ale#fixers#nixpkgsfmt#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options),
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
||||
\}
|
||||
endfunction
|
||||
Loaded 100 of 359 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user