mirror of
https://github.com/dense-analysis/ale.git
synced 2026-05-24 17:28:42 +08:00
Compare commits
61 Commits
4217461c48
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a3af30fb6 | |||
| c25eaa30df | |||
| ec599ef5a7 | |||
| 2d5a15d501 | |||
| f3d85691a5 | |||
| 307f2b99ff | |||
| 7b5b854fc4 | |||
| 916c8764ce | |||
| 641294465e | |||
| c809c68f7e | |||
| 78122497f5 | |||
| ab3531083c | |||
| c59c0d1a57 | |||
| 051d12c72d | |||
| 6ba798d2e7 | |||
| b1b027d5e6 | |||
| 674a8cced8 | |||
| 6b63f4e70a | |||
| ba8b9cbab9 | |||
| 7940a46d5a | |||
| 90d8f8d2d2 | |||
| 3d3b75cdc5 | |||
| 0369442b06 | |||
| 69c945d5da | |||
| cb8c4662aa | |||
| d87b4956ad | |||
| 3c837714cd | |||
| bee0b49067 | |||
| be0dfdb671 | |||
| b5f8cb296a | |||
| af5a38c697 | |||
| e762262f44 | |||
| 6d99629461 | |||
| f730dedca7 | |||
| 9b51f66960 | |||
| e3c1528619 | |||
| 646d956630 | |||
| d59cb7b3c2 | |||
| c0dd8167a6 | |||
| 8eb4803da9 | |||
| 0360a73644 | |||
| dd6e6f1b15 | |||
| fa3d4f2f13 | |||
| 710e1aac9c | |||
| 281eb4808c | |||
| ca1da76d5e | |||
| 962a932ed4 | |||
| 395d9fa2aa | |||
| 5f286eb909 | |||
| 1f0f9ef28d | |||
| e56b55b65d | |||
| 260c756a9b | |||
| 86d8ada5cb | |||
| de2d3da738 | |||
| b9d7f56471 | |||
| 6d8e4a641c | |||
| d2f4090c33 | |||
| 59c6b4f7b0 | |||
| 21d5de18b2 | |||
| ed26d1f1d9 | |||
| 9811114948 |
@@ -1,62 +0,0 @@
|
|||||||
---
|
|
||||||
# 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"'
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# 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
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
# 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",
|
||||||
|
],
|
||||||
|
)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* @w0rp
|
||||||
+60
-10
@@ -11,9 +11,10 @@ on: # yamllint disable-line rule:truthy
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_image:
|
build_image:
|
||||||
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Build docker run image
|
- name: Build docker run image
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
@@ -21,18 +22,67 @@ jobs:
|
|||||||
DOCKER_HUB_PASS: ${{ secrets.DOCKER_HUB_PASS }}
|
DOCKER_HUB_PASS: ${{ secrets.DOCKER_HUB_PASS }}
|
||||||
run: ./run-tests --build-image
|
run: ./run-tests --build-image
|
||||||
test_ale:
|
test_ale:
|
||||||
|
name: ${{ matrix.name }}
|
||||||
needs: build_image
|
needs: build_image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
vim-version:
|
include:
|
||||||
- '--vim-80-only'
|
- name: Lint
|
||||||
- '--vim-90-only'
|
test-args: --linters-only
|
||||||
- '--neovim-07-only'
|
- name: Lua
|
||||||
- '--neovim-08-only'
|
test-args: --lua-only
|
||||||
- '--lua-only'
|
- name: Neovim 0.10 Linux
|
||||||
- '--linters-only'
|
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
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ./run-tests -v ${{ matrix.vim-version }}
|
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
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# ALE 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.
|
||||||
+60
-10
@@ -1,28 +1,78 @@
|
|||||||
ARG TESTBED_VIM_VERSION=24
|
#############################################################################
|
||||||
|
# Base testbed image copied from:
|
||||||
|
# https://github.com/Vimjas/vim-testbed/blob/master/Dockerfile
|
||||||
|
FROM alpine:3.23 as testbed
|
||||||
|
|
||||||
FROM testbed/vim:${TESTBED_VIM_VERSION}
|
RUN apk --no-cache upgrade
|
||||||
|
|
||||||
ENV PACKAGES="\
|
ENV PACKAGES="\
|
||||||
|
build-base \
|
||||||
|
linux-headers \
|
||||||
|
cmake \
|
||||||
|
coreutils \
|
||||||
|
msgpack-c-dev \
|
||||||
|
libtermkey-dev \
|
||||||
|
libvterm-dev \
|
||||||
|
unibilium-dev \
|
||||||
|
ncurses-dev \
|
||||||
lua5.1 \
|
lua5.1 \
|
||||||
lua5.1-dev \
|
lua5.1-dev \
|
||||||
|
lua5.1-lpeg \
|
||||||
|
lua5.1-mpack \
|
||||||
lua5.1-busted \
|
lua5.1-busted \
|
||||||
bash \
|
bash \
|
||||||
git \
|
git \
|
||||||
python2 \
|
|
||||||
python3 \
|
|
||||||
py3-pip \
|
|
||||||
grep \
|
grep \
|
||||||
sed \
|
sed \
|
||||||
|
python3 \
|
||||||
|
py3-pip \
|
||||||
|
gettext-dev \
|
||||||
|
libuv-dev \
|
||||||
|
libluv \
|
||||||
|
lua-luv-dev \
|
||||||
|
utf8proc-dev \
|
||||||
|
vint \
|
||||||
|
curl \
|
||||||
|
gettext-dev \
|
||||||
|
libtool \
|
||||||
|
ninja \
|
||||||
|
tree-sitter-dev \
|
||||||
"
|
"
|
||||||
|
|
||||||
RUN apk --update add $PACKAGES && \
|
RUN apk --update add $PACKAGES && \
|
||||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
RUN install_vim -tag v8.0.0027 -build \
|
RUN adduser -h /home/vimtest -s /bin/sh -D -u 8465 vimtest
|
||||||
-tag v9.0.0297 -build \
|
|
||||||
-tag neovim:v0.7.0 -build \
|
|
||||||
-tag neovim:v0.8.0 -build
|
|
||||||
|
|
||||||
RUN pip install vim-vint==0.3.21
|
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 git clone https://github.com/junegunn/vader.vim vader && \
|
RUN git clone https://github.com/junegunn/vader.vim vader && \
|
||||||
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
|
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# Asynchronous Lint Engine
|
# 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://ci.appveyor.com/project/dense-analysis/ale) [](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://discord.gg/5zFD6pQxDk)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
|
ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
|
||||||
and semantic errors) in Neovim 0.7.0+ and Vim 8.0+ while you edit your text files,
|
and semantic errors) in Neovim 0.7.0+ and Vim 8.2+ while you edit your text files,
|
||||||
and acts as a Vim [Language Server Protocol](https://langserver.org/) client.
|
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>
|
<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,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for AsciiDoc files
|
" Description: proselint for AsciiDoc files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('asciidoc', {
|
call ale#linter#Define('asciidoc', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
|||||||
" -fsyntax-only doesn't catch everything.
|
" -fsyntax-only doesn't catch everything.
|
||||||
return '%e -x assembler'
|
return '%e -x assembler'
|
||||||
\ . ' -o ' . g:ale#util#nul_file
|
\ . ' -o ' . g:ale#util#nul_file
|
||||||
\ . '-iquote %s:h'
|
\ . ' -iquote %s:h'
|
||||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,18 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
|||||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||||
\ : ''
|
\ : ''
|
||||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||||
|
" Versions >=2.13 don't allow using --project in conjunction with an
|
||||||
|
" explicit source file.
|
||||||
|
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
|
||||||
|
\ ? ' %t'
|
||||||
|
\ : ''
|
||||||
|
|
||||||
return '%e -q --language=c'
|
return '%e -q --language=c'
|
||||||
\ . l:template
|
\ . l:template
|
||||||
\ . ale#Pad(l:compile_commands_option)
|
\ . ale#Pad(l:compile_commands_option)
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
||||||
\ . l:buffer_path_include
|
\ . l:buffer_path_include
|
||||||
\ . ' %t'
|
\ . l:source_file
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
call ale#linter#Define('c', {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function! ale_linters#cpp#clazy#GetCommand(buffer) abort
|
|||||||
return '%e'
|
return '%e'
|
||||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %s'
|
\ . ' %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,18 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
|||||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||||
\ : ''
|
\ : ''
|
||||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||||
|
" Versions >=2.13 don't allow using --project in conjunction with an
|
||||||
|
" explicit source file.
|
||||||
|
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
|
||||||
|
\ ? ' %t'
|
||||||
|
\ : ''
|
||||||
|
|
||||||
return '%e -q --language=c++'
|
return '%e -q --language=c++'
|
||||||
\ . l:template
|
\ . l:template
|
||||||
\ . ale#Pad(l:compile_commands_option)
|
\ . ale#Pad(l:compile_commands_option)
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
||||||
\ . l:buffer_path_include
|
\ . l:buffer_path_include
|
||||||
\ . ' %t'
|
\ . l:source_file
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
||||||
|
|
||||||
return 'mcs -unsafe --parse'
|
return 'mcs -unsafe --parse'
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0
|
|||||||
|
|
||||||
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
||||||
\ . ' --stdin-filename %s'
|
\ . ' --no-color --stdin-filename %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('css', {
|
call ale#linter#Define('css', {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
|||||||
\ 'lnum': str2nr(l:match[2]),
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[5],
|
\ 'text': l:match[5],
|
||||||
\ 'filename': fnamemodify(l:match[1], ':p'),
|
\ 'filename': ale#path#Simplify(fnamemodify(l:match[1], ':p')),
|
||||||
\}
|
\}
|
||||||
|
|
||||||
if !empty(l:match[3])
|
if !empty(l:match[3])
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
|||||||
" Matches patterns lines like the following:
|
" 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.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
|
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||||
let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
|
" 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:output = []
|
let l:output = []
|
||||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
" Author: Paul Monson <pmonson711@pm.me>
|
||||||
|
" Description: Expert integration (https://github.com/elixir-lang/expert)
|
||||||
|
|
||||||
|
call ale#Set('elixir_expert_executable', 'expert')
|
||||||
|
|
||||||
|
call ale#linter#Define('elixir', {
|
||||||
|
\ 'name': 'expert',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'elixir_expert_executable')},
|
||||||
|
\ 'command': '%e --stdio',
|
||||||
|
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||||
|
\})
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Jansen Mitchell https://github.com/JansenMitchell
|
" Author: Jansen Mitchell https://github.com/JansenMitchell
|
||||||
" Description: proselint for Fountain files
|
" Description: proselint for Fountain files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('fountain', {
|
call ale#linter#Define('fountain', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function! ale_linters#go#revive#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'go_revive_options')
|
let l:options = ale#Var(a:buffer, 'go_revive_options')
|
||||||
|
|
||||||
return ale#go#EnvString(a:buffer) . '%e'
|
return ale#go#EnvString(a:buffer) . '%e'
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
|||||||
|
|
||||||
if l:lint_package
|
if l:lint_package
|
||||||
return l:env . '%e'
|
return l:env . '%e'
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
\ . ale#Pad(l:options) . ' .'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:env . '%e'
|
return l:env . '%e'
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %s:t'
|
\ . ' %s:t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
|
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
|
||||||
|
|
||||||
return '%e --failon none --output json'
|
return '%e --failon none --output json'
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for Vim help files
|
" Description: proselint for Vim help files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('help', {
|
call ale#linter#Define('help', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for HTML files
|
" Description: proselint for HTML files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('html', {
|
call ale#linter#Define('html', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ function! ale_linters#html#stylelint#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'html_stylelint_options')
|
let l:options = ale#Var(a:buffer, 'html_stylelint_options')
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
return ale#Escape(l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --stdin-filename %s'
|
\ . ' --no-color --stdin-filename %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('html', {
|
call ale#linter#Define('html', {
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
call ale#Set('html_superhtml_executable', 'superhtml')
|
||||||
|
call ale#Set('html_superhtml_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! ale_linters#html#superhtml#GetCommand(buffer) abort
|
||||||
|
return '%e check --stdin'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#html#superhtml#Handle(buffer, lines) abort
|
||||||
|
let l:output = []
|
||||||
|
let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\): \(.*\)$'
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if !empty(l:match)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
|
\ 'col': str2nr(l:match[3]),
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\ 'type': 'E'
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('html', {
|
||||||
|
\ 'name': 'superhtml',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'html_superhtml_executable')},
|
||||||
|
\ 'command': function('ale_linters#html#superhtml#GetCommand'),
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'callback': 'ale_linters#html#superhtml#Handle',
|
||||||
|
\})
|
||||||
@@ -19,7 +19,7 @@ function! ale_linters#javascript#standard#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
|
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
|
||||||
|
|
||||||
return ale#node#Executable(a:buffer, l:executable)
|
return ale#node#Executable(a:buffer, l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --stdin %s'
|
\ . ' --stdin %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
" Description: linter for jinja using j2lint
|
||||||
|
|
||||||
|
call ale#Set('jinja_j2lint_executable', 'j2lint')
|
||||||
|
call ale#Set('jinja_j2lint_options', '')
|
||||||
|
call ale#Set('jinja_j2lint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
call ale#Set('jinja_j2lint_auto_pipenv', 0)
|
||||||
|
call ale#Set('jinja_j2lint_auto_poetry', 0)
|
||||||
|
call ale#Set('jinja_j2lint_auto_uv', 0)
|
||||||
|
|
||||||
|
function! ale_linters#jinja#j2lint#GetExecutable(buffer) abort
|
||||||
|
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'jinja_j2lint_auto_pipenv'))
|
||||||
|
\ && ale#python#PipenvPresent(a:buffer)
|
||||||
|
return 'pipenv'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'jinja_j2lint_auto_poetry'))
|
||||||
|
\ && ale#python#PoetryPresent(a:buffer)
|
||||||
|
return 'poetry'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'jinja_j2lint_auto_uv'))
|
||||||
|
\ && ale#python#UvPresent(a:buffer)
|
||||||
|
return 'uv'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#python#FindExecutable(a:buffer, 'jinja_j2lint', ['j2lint'])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#jinja#j2lint#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale_linters#jinja#j2lint#GetExecutable(a:buffer)
|
||||||
|
|
||||||
|
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||||
|
\ ? ' run j2lint'
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
return ale#Escape(l:executable) . l:exec_args
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'jinja_j2lint_options'))
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('jinja', {
|
||||||
|
\ 'name': 'j2lint',
|
||||||
|
\ 'executable': function('ale_linters#jinja#j2lint#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#jinja#j2lint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||||
|
\})
|
||||||
@@ -7,7 +7,7 @@ call ale#Set('less_stylelint_use_global', get(g:, 'ale_use_global_executables',
|
|||||||
function! ale_linters#less#stylelint#GetCommand(buffer) abort
|
function! ale_linters#less#stylelint#GetCommand(buffer) abort
|
||||||
let l:options = ale#Var(a:buffer, 'less_stylelint_options')
|
let l:options = ale#Var(a:buffer, 'less_stylelint_options')
|
||||||
|
|
||||||
return '%e' . ale#Pad(l:options) . ' --stdin-filename %s'
|
return '%e' . ale#Pad(l:options) . ' --no-color --stdin-filename %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('less', {
|
call ale#linter#Define('less', {
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
" 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,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for mail files
|
" Description: proselint for mail files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('mail', {
|
call ale#linter#Define('mail', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
" 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
|
||||||
@@ -14,7 +14,7 @@ function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
|
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
return ale#Escape(l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
|
\ . ale#Pad(l:options) . ' %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('markdown', {
|
call ale#linter#Define('markdown', {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function! ale_linters#markdown#mdl#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
|
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
|
||||||
|
|
||||||
return ale#Escape(l:executable) . l:exec_args
|
return ale#Escape(l:executable) . l:exec_args
|
||||||
\ . ' -j' . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ' -j' . ale#Pad(l:options)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
|
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: poohzrn https://github.com/poohzrn
|
" Author: poohzrn https://github.com/poohzrn
|
||||||
" Description: proselint for Markdown files
|
" Description: proselint for Markdown files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('markdown', {
|
call ale#linter#Define('markdown', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ function! ale_linters#markdown#pymarkdown#GetCommand(buffer) abort
|
|||||||
\ : ''
|
\ : ''
|
||||||
|
|
||||||
return ale#Escape(l:executable) . l:exec_args
|
return ale#Escape(l:executable) . l:exec_args
|
||||||
\ . ' '
|
\ . ale#Pad(ale#Var(a:buffer, 'markdown_pymarkdown_options'))
|
||||||
\ . ale#Var(a:buffer, 'markdown_pymarkdown_options')
|
\ . ' scan-stdin'
|
||||||
\ . 'scan-stdin'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort
|
function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
" 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,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for nroff files
|
" Description: proselint for nroff files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('nroff', {
|
call ale#linter#Define('nroff', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -5,23 +5,6 @@
|
|||||||
call ale#Set('perl_perl_executable', 'perl')
|
call ale#Set('perl_perl_executable', 'perl')
|
||||||
" Please note that perl_perl_options does not exist here.
|
" 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', '.git' ]
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#Set('perl_languageserver_config', {})
|
call ale#Set('perl_languageserver_config', {})
|
||||||
|
|
||||||
function! s:get_lsp_config(buffer) abort
|
function! s:get_lsp_config(buffer) abort
|
||||||
@@ -39,5 +22,5 @@ call ale#linter#Define('perl', {
|
|||||||
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
|
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
|
||||||
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
|
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
|
||||||
\ 'lsp_config': {b -> s:get_lsp_config(b)},
|
\ 'lsp_config': {b -> s:get_lsp_config(b)},
|
||||||
\ 'project_root': function('ale_linters#perl#languageserver#GetProjectRoot'),
|
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
|
||||||
\ })
|
\ })
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
" 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'),
|
||||||
|
\ })
|
||||||
@@ -7,6 +7,34 @@ call ale#Set('php_phpcs_options', '')
|
|||||||
call ale#Set('php_phpcs_executable', 'phpcs')
|
call ale#Set('php_phpcs_executable', 'phpcs')
|
||||||
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
|
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
|
function! ale_linters#php#phpcs#GetCommand(buffer) abort
|
||||||
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
|
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
|
||||||
let l:standard_option = !empty(l:standard)
|
let l:standard_option = !empty(l:standard)
|
||||||
@@ -48,7 +76,7 @@ call ale#linter#Define('php', {
|
|||||||
\ 'vendor/bin/phpcs',
|
\ 'vendor/bin/phpcs',
|
||||||
\ 'phpcs'
|
\ 'phpcs'
|
||||||
\ ])},
|
\ ])},
|
||||||
\ 'cwd': '%s:h',
|
\ 'cwd': function('ale_linters#php#phpcs#GetCwd'),
|
||||||
\ 'command': function('ale_linters#php#phpcs#GetCommand'),
|
\ 'command': function('ale_linters#php#phpcs#GetCommand'),
|
||||||
\ 'callback': 'ale_linters#php#phpcs#Handle',
|
\ 'callback': 'ale_linters#php#phpcs#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
|||||||
|
|
||||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||||
|
|
||||||
|
if type(l:level) is v:t_number
|
||||||
|
let l:level = string(l:level)
|
||||||
|
endif
|
||||||
|
|
||||||
if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer))
|
if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer))
|
||||||
" if no configuration file is found, then use 4 as a default level
|
" if no configuration file is found, then use 4 as a default level
|
||||||
let l:level = '4'
|
let l:level = '4'
|
||||||
@@ -83,6 +87,10 @@ function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
|
|||||||
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if empty(l:result)
|
||||||
|
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.dist.neon')
|
||||||
|
endif
|
||||||
|
|
||||||
return l:result
|
return l:result
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function! ale_linters#php#tlint#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'php_tlint_options')
|
let l:options = ale#Var(a:buffer, 'php_tlint_options')
|
||||||
|
|
||||||
return ale#node#Executable(a:buffer, l:executable)
|
return ale#node#Executable(a:buffer, l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' lint %s'
|
\ . ' lint %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Cian Butler https://github.com/butlerx
|
" Author: Cian Butler https://github.com/butlerx
|
||||||
" Description: proselint for PO files
|
" Description: proselint for PO files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('po', {
|
call ale#linter#Define('po', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for Pod files
|
" Description: proselint for Pod files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('pod', {
|
call ale#linter#Define('pod', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
|
|||||||
|
|
||||||
return '%e lint'
|
return '%e lint'
|
||||||
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
|
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %s#include_package_files=true'
|
\ . ' %s#include_package_files=true'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ function! ale_linters#python#flake8#GetCommand(buffer, version) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
||||||
|
|
||||||
return ale#Escape(l:executable) . l:exec_args
|
return ale#Escape(l:executable) . l:exec_args
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --format=default'
|
\ . ' --format=default'
|
||||||
\ . l:display_name_args . ' -'
|
\ . l:display_name_args . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
" 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')},
|
||||||
|
\})
|
||||||
@@ -12,7 +12,7 @@ function! ale_linters#rego#opacheck#GetCommand(buffer) abort
|
|||||||
|
|
||||||
return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer))
|
||||||
\ . ' check %s:h --format json '
|
\ . ' check %s:h --format json '
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#rego#opacheck#Handle(buffer, lines) abort
|
function! ale_linters#rego#opacheck#Handle(buffer, lines) abort
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
" Author: John Jackson <john@johnridesa.bike>
|
||||||
|
" Description: The official language server for ReScript.
|
||||||
|
|
||||||
|
call ale#Set('rescript_language_server_executable', 'rescript-language-server')
|
||||||
|
call ale#Set(
|
||||||
|
\ 'rescript_language_server_use_global',
|
||||||
|
\ get(g:, 'ale_use_global_executables', v:true),
|
||||||
|
\ )
|
||||||
|
|
||||||
|
function! s:GetProjectRoot(buffer) abort
|
||||||
|
let l:config_file = ale#path#FindNearestFile(a:buffer, 'rescript.json')
|
||||||
|
|
||||||
|
return !empty(l:config_file) ? fnamemodify(l:config_file, ':h') : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('rescript', {
|
||||||
|
\ 'name': 'rescript_language_server',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#path#FindExecutable(b, 'rescript_language_server', [
|
||||||
|
\ 'node_modules/.bin/rescript-language-server'
|
||||||
|
\ ])},
|
||||||
|
\ 'command': '%e --stdio',
|
||||||
|
\ 'project_root': function('s:GetProjectRoot'),
|
||||||
|
\})
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for reStructuredText files
|
" Description: proselint for reStructuredrst files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('rst', {
|
call ale#linter#Define('rst', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
" Author: John Nduli https://github.com/jnduli
|
" Authors:
|
||||||
" Description: Rstcheck for reStructuredText files
|
" John Nduli https://github.com/jnduli,
|
||||||
|
" Michael Goerz https://github.com/goerz
|
||||||
|
|
||||||
|
call ale#Set('rst_rstcheck_executable', 'rstcheck')
|
||||||
|
call ale#Set('rst_rstcheck_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#rst#rstcheck#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'rst_rstcheck_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
|
function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
|
||||||
" matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline
|
" matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline
|
||||||
@@ -21,11 +29,35 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
|
|||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#rst#rstcheck#GetCommand(buffer, version) abort
|
||||||
|
let l:executable = ale_linters#rst#rstcheck#GetExecutable(a:buffer)
|
||||||
|
let l:options = ale#Var(a:buffer, 'rst_rstcheck_options')
|
||||||
|
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||||
|
let l:exec_args = ale#Pad(l:options)
|
||||||
|
|
||||||
|
if ale#semver#GTE(a:version, [3, 4, 0])
|
||||||
|
let l:exec_args .= ' --config ' . ale#Escape(l:dir)
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#Escape(l:executable)
|
||||||
|
\ . l:exec_args
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#rst#rstcheck#GetCommandWithVersionCheck(buffer) abort
|
||||||
|
return ale#semver#RunWithVersionCheck(
|
||||||
|
\ a:buffer,
|
||||||
|
\ ale_linters#rst#rstcheck#GetExecutable(a:buffer),
|
||||||
|
\ '%e --version',
|
||||||
|
\ function('ale_linters#rst#rstcheck#GetCommand')
|
||||||
|
\)
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('rst', {
|
call ale#linter#Define('rst', {
|
||||||
\ 'name': 'rstcheck',
|
\ 'name': 'rstcheck',
|
||||||
\ 'executable': 'rstcheck',
|
\ 'executable': 'rstcheck',
|
||||||
\ 'cwd': '%s:h',
|
\ 'cwd': '%s:h',
|
||||||
\ 'command': 'rstcheck %t',
|
\ 'command': function('ale_linters#rst#rstcheck#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale_linters#rst#rstcheck#Handle',
|
\ 'callback': 'ale_linters#rst#rstcheck#Handle',
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ call ale#Set('ruby_solargraph_executable', 'solargraph')
|
|||||||
call ale#Set('ruby_solargraph_options', {})
|
call ale#Set('ruby_solargraph_options', {})
|
||||||
|
|
||||||
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
|
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
|
||||||
return '%e' . ale#Pad('stdio')
|
let l:executable = ale#Var(a:buffer, 'ruby_solargraph_executable')
|
||||||
|
|
||||||
|
return ale#ruby#EscapeExecutable(l:executable, 'solargraph')
|
||||||
|
\ . ale#Pad('stdio')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('ruby', {
|
call ale#linter#Define('ruby', {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
|
|||||||
|
|
||||||
return ale#ruby#EscapeExecutable(l:executable, 'srb')
|
return ale#ruby#EscapeExecutable(l:executable, 'srb')
|
||||||
\ . ' tc'
|
\ . ' tc'
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --lsp'
|
\ . ' --lsp'
|
||||||
\ . (l:enable_watchman ? '' : ' --disable-watchman')
|
\ . (l:enable_watchman ? '' : ' --disable-watchman')
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function! ale_linters#rust#rustc#RustcCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'rust_rustc_options')
|
let l:options = ale#Var(a:buffer, 'rust_rustc_options')
|
||||||
|
|
||||||
return 'rustc --error-format=json'
|
return 'rustc --error-format=json'
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . l:dependencies . ' -'
|
\ . l:dependencies . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function! ale_linters#sass#sasslint#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
|
let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
|
||||||
|
|
||||||
return ale#node#Executable(a:buffer, l:executable)
|
return ale#node#Executable(a:buffer, l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' -v -q -f compact %t'
|
\ . ' -v -q -f compact %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ call ale#linter#Define('sass', {
|
|||||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [
|
\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [
|
||||||
\ 'node_modules/.bin/stylelint',
|
\ 'node_modules/.bin/stylelint',
|
||||||
\ ])},
|
\ ])},
|
||||||
\ 'command': '%e --stdin-filename %s',
|
\ 'command': '%e --no-color --stdin-filename %s',
|
||||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function! ale_linters#scss#sasslint#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'scss_sasslint_options')
|
let l:options = ale#Var(a:buffer, 'scss_sasslint_options')
|
||||||
|
|
||||||
return ale#node#Executable(a:buffer, l:executable)
|
return ale#node#Executable(a:buffer, l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' -v -q -f compact %t'
|
\ . ' -v -q -f compact %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables',
|
|||||||
|
|
||||||
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
|
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
|
||||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
|
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
|
||||||
\ . ' --stdin-filename %s'
|
\ . ' --no-color --stdin-filename %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('scss', {
|
call ale#linter#Define('scss', {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ call ale#Set('stylus_stylelint_use_global', get(g:, 'ale_use_global_executables'
|
|||||||
function! ale_linters#stylus#stylelint#GetCommand(buffer) abort
|
function! ale_linters#stylus#stylelint#GetCommand(buffer) abort
|
||||||
return '%e'
|
return '%e'
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options'))
|
\ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options'))
|
||||||
\ . ' --stdin-filename %s'
|
\ . ' --no-color --stdin-filename %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('stylus', {
|
call ale#linter#Define('stylus', {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ call ale#Set('sugarss_stylelint_use_global', get(g:, 'ale_use_global_executables
|
|||||||
function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort
|
function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort
|
||||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options'))
|
return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options'))
|
||||||
\ . ' --syntax=sugarss'
|
\ . ' --syntax=sugarss'
|
||||||
\ . ' --stdin-filename %s'
|
\ . ' --no-color --stdin-filename %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('sugarss', {
|
call ale#linter#Define('sugarss', {
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ endfunction
|
|||||||
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
|
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
|
||||||
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
|
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') : ''
|
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: poohzrn https://github.com/poohzrn
|
" Author: poohzrn https://github.com/poohzrn
|
||||||
" Description: proselint for TeX files
|
" Description: proselint for TeX files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('tex', {
|
call ale#linter#Define('tex', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for Texinfo files
|
" Description: proselint for Texinfo files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('texinfo', {
|
call ale#linter#Define('texinfo', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: poohzrn https://github.com/poohzrn
|
" Author: poohzrn https://github.com/poohzrn
|
||||||
" Description: proselint for text files
|
" Description: proselint for text files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('text', {
|
call ale#linter#Define('text', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
" Author: chew-z https://github.com/chew-z
|
" Author: chew-z https://github.com/chew-z
|
||||||
" Description: vale for text files
|
" Description: vale for text files
|
||||||
|
|
||||||
|
call ale#Set('vale_executable', 'vale')
|
||||||
|
call ale#Set('vale_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#text#vale#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'vale_executable')
|
||||||
|
|
||||||
|
let l:options = ale#Var(a:buffer, 'vale_options')
|
||||||
|
|
||||||
|
return ale#Escape(l:executable)
|
||||||
|
\ . ale#Pad(l:options)
|
||||||
|
\ . ' --output=JSON %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('text', {
|
call ale#linter#Define('text', {
|
||||||
\ 'name': 'vale',
|
\ 'name': 'vale',
|
||||||
\ 'executable': 'vale',
|
\ 'executable': 'vale',
|
||||||
\ 'command': 'vale --output=JSON %t',
|
\ 'command': function('ale_linters#text#vale#GetCommand'),
|
||||||
\ 'callback': 'ale#handlers#vale#Handle',
|
\ 'callback': 'ale#handlers#vale#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -3,6 +3,19 @@
|
|||||||
|
|
||||||
call ale#Set('toml_tombi_executable', 'tombi')
|
call ale#Set('toml_tombi_executable', 'tombi')
|
||||||
call ale#Set('toml_tombi_lsp_options', '')
|
call ale#Set('toml_tombi_lsp_options', '')
|
||||||
|
call ale#Set('toml_tombi_online', 0)
|
||||||
|
|
||||||
|
function! ale_linters#toml#tombi#GetCommand(buffer) abort
|
||||||
|
let l:offline = ''
|
||||||
|
|
||||||
|
if !ale#Var(a:buffer, 'toml_tombi_online')
|
||||||
|
let l:offline = '--offline'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return '%e lsp'
|
||||||
|
\ . ale#Pad(l:offline)
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'toml_tombi_lsp_options'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#toml#tombi#GetProjectRoot(buffer) abort
|
function! ale_linters#toml#tombi#GetProjectRoot(buffer) abort
|
||||||
" Try to find nearest tombi.toml
|
" Try to find nearest tombi.toml
|
||||||
@@ -33,6 +46,6 @@ call ale#linter#Define('toml', {
|
|||||||
\ 'name': 'tombi',
|
\ 'name': 'tombi',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable': {b -> ale#Var(b, 'toml_tombi_executable')},
|
\ 'executable': {b -> ale#Var(b, 'toml_tombi_executable')},
|
||||||
\ 'command': {b -> '%e lsp' . ale#Pad(ale#Var(b, 'toml_tombi_lsp_options'))},
|
\ 'command': function('ale_linters#toml#tombi#GetCommand'),
|
||||||
\ 'project_root': function('ale_linters#toml#tombi#GetProjectRoot'),
|
\ 'project_root': function('ale_linters#toml#tombi#GetProjectRoot'),
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function! ale_linters#typescript#standard#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'typescript_standard_options')
|
let l:options = ale#Var(a:buffer, 'typescript_standard_options')
|
||||||
|
|
||||||
return ale#node#Executable(a:buffer, l:executable)
|
return ale#node#Executable(a:buffer, l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --stdin %s'
|
\ . ' --stdin %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
" Author: Daniel M. Capella https://github.com/polyzen
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
" Description: proselint for XHTML files
|
" Description: proselint for XHTML files
|
||||||
|
|
||||||
|
call ale#Set('proselint_executable', 'proselint')
|
||||||
|
|
||||||
call ale#linter#Define('xhtml', {
|
call ale#linter#Define('xhtml', {
|
||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': function('ale#proselint#GetExecutable'),
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ function! ale#ShouldDoNothing(buffer) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Do nothing for diff buffers.
|
" Do nothing for diff buffers.
|
||||||
if getbufvar(a:buffer, '&diff')
|
if getbufvar(a:buffer, '&diff') && !get(g:, 'ale_lint_diff', 0)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+47
-21
@@ -5,12 +5,13 @@ call ale#Set('c_parse_makefile', 0)
|
|||||||
call ale#Set('c_always_make', has('unix') && !has('macunix'))
|
call ale#Set('c_always_make', has('unix') && !has('macunix'))
|
||||||
call ale#Set('c_parse_compile_commands', 1)
|
call ale#Set('c_parse_compile_commands', 1)
|
||||||
|
|
||||||
let s:sep = has('win32') ? '\' : '/'
|
let s:is_windows = has('win32') || has('win64') || has('win32unix')
|
||||||
|
let s:sep = s:is_windows ? '\' : '/'
|
||||||
|
|
||||||
" Set just so tests can override it.
|
" Set just so tests can override it.
|
||||||
let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt']
|
let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt']
|
||||||
|
|
||||||
let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
|
call ale#Set('c_build_dir_names', [
|
||||||
\ 'build',
|
\ 'build',
|
||||||
\ 'build/Debug',
|
\ 'build/Debug',
|
||||||
\ 'build/Release',
|
\ 'build/Release',
|
||||||
@@ -18,10 +19,6 @@ let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
|
|||||||
\])
|
\])
|
||||||
|
|
||||||
function! s:CanParseMakefile(buffer) abort
|
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')
|
return ale#Var(a:buffer, 'c_parse_makefile')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -249,11 +246,19 @@ function! ale#c#FindCompileCommands(buffer) abort
|
|||||||
" Search in build directories if we can't find it in the project.
|
" 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:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||||
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')
|
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')
|
||||||
let l:c_build_dir = l:path . s:sep . l:dirname
|
let l:c_build_dir = ale#path#GetAbsPath(l:path, l:dirname)
|
||||||
let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json'
|
let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json'
|
||||||
|
|
||||||
if filereadable(l:json_file)
|
if filereadable(l:json_file)
|
||||||
return [l:path, l:json_file]
|
" For absolute build dir paths, use the parent
|
||||||
|
" of the build dir as the project root. For
|
||||||
|
" relative paths, use the directory found by
|
||||||
|
" searching upwards from the file.
|
||||||
|
let l:root = ale#path#IsAbsolute(l:dirname)
|
||||||
|
\ ? fnamemodify(l:c_build_dir, ':h')
|
||||||
|
\ : l:path
|
||||||
|
|
||||||
|
return [l:root, l:json_file]
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
@@ -382,23 +387,40 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
|
|||||||
let l:file_list = get(a:file_lookup, l:buffer_filename, [])
|
let l:file_list = get(a:file_lookup, l:buffer_filename, [])
|
||||||
|
|
||||||
" We may have to look for /foo/bar instead of C:\foo\bar
|
" We may have to look for /foo/bar instead of C:\foo\bar
|
||||||
if empty(l:file_list) && has('win32')
|
if empty(l:file_list) && s:is_windows
|
||||||
let l:file_list = get(
|
" Try without the drive letter.
|
||||||
\ a:file_lookup,
|
let l:no_drive = ale#path#RemoveDriveLetter(l:buffer_filename)
|
||||||
\ 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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Try the absolute path to the directory second.
|
" Try the absolute path to the directory second.
|
||||||
let l:dir_list = get(a:dir_lookup, l:dir, [])
|
let l:dir_list = get(a:dir_lookup, l:dir, [])
|
||||||
|
|
||||||
if empty(l:dir_list) && has('win32')
|
if empty(l:dir_list) && s:is_windows
|
||||||
let l:dir_list = get(
|
let l:no_drive_dir = ale#path#RemoveDriveLetter(l:dir)
|
||||||
\ a:dir_lookup,
|
|
||||||
\ 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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if empty(l:file_list) && empty(l:dir_list)
|
if empty(l:file_list) && empty(l:dir_list)
|
||||||
@@ -420,7 +442,7 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
|
|||||||
let l:key = fnamemodify(l:buffer_filename, ':r') . l:suffix
|
let l:key = fnamemodify(l:buffer_filename, ':r') . l:suffix
|
||||||
let l:file_list = get(a:file_lookup, l:key, [])
|
let l:file_list = get(a:file_lookup, l:key, [])
|
||||||
|
|
||||||
if empty(l:file_list) && has('win32')
|
if empty(l:file_list) && s:is_windows
|
||||||
let l:file_list = get(
|
let l:file_list = get(
|
||||||
\ a:file_lookup,
|
\ a:file_lookup,
|
||||||
\ ale#path#RemoveDriveLetter(l:key),
|
\ ale#path#RemoveDriveLetter(l:key),
|
||||||
@@ -446,8 +468,12 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
|
|||||||
|
|
||||||
" Load the flags for this file, or for a source file matching the
|
" Load the flags for this file, or for a source file matching the
|
||||||
" header file.
|
" 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 (
|
if (
|
||||||
\ bufnr(l:filename) is a:buffer
|
\ bufnr(l:filename) is a:buffer
|
||||||
|
\ || ale#path#RemoveDriveLetter(l:filename)
|
||||||
|
\ is? ale#path#RemoveDriveLetter(l:buffer_filename)
|
||||||
\ || (
|
\ || (
|
||||||
\ !empty(l:source_file)
|
\ !empty(l:source_file)
|
||||||
\ && l:filename[-len(l:source_file):] is? l:source_file
|
\ && l:filename[-len(l:source_file):] is? l:source_file
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ if !exists('s:buffer_data')
|
|||||||
let s:buffer_data = {}
|
let s:buffer_data = {}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:is_windows = has('win32') || has('win64') || has('win32unix')
|
||||||
|
|
||||||
" The regular expression used for formatting filenames with modifiers.
|
" The regular expression used for formatting filenames with modifiers.
|
||||||
let s:path_format_regex = '\v\%s(%(:h|:t|:r|:e)*)'
|
let s:path_format_regex = '\v\%s(%(:h|:t|:r|:e)*)'
|
||||||
|
|
||||||
@@ -140,7 +142,7 @@ function! s:TemporaryFilename(buffer) abort
|
|||||||
|
|
||||||
" Create a temporary filename, <temp_dir>/<original_basename>
|
" Create a temporary filename, <temp_dir>/<original_basename>
|
||||||
" The file itself will not be created by this function.
|
" The file itself will not be created by this function.
|
||||||
return ale#util#Tempname() . (has('win32') ? '\' : '/') . l:filename
|
return ale#path#GetAbsPath(ale#util#Tempname(), l:filename)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Given part of a command, replace any % with %%, so that no characters in
|
" Given part of a command, replace any % with %%, so that no characters in
|
||||||
@@ -178,7 +180,7 @@ function! ale#command#CdString(directory) abort
|
|||||||
\ ? a:directory
|
\ ? a:directory
|
||||||
\ : ale#Escape(a:directory)
|
\ : ale#Escape(a:directory)
|
||||||
|
|
||||||
if has('win32')
|
if s:is_windows
|
||||||
return 'cd /d ' . l:directory . ' && '
|
return 'cd /d ' . l:directory . ' && '
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -392,7 +394,7 @@ function! ale#command#Run(buffer, command, Callback, ...) abort
|
|||||||
let s:fake_job_id = get(s:, 'fake_job_id', 0) + 1
|
let s:fake_job_id = get(s:, 'fake_job_id', 0) + 1
|
||||||
let l:job_id = s:fake_job_id
|
let l:job_id = s:fake_job_id
|
||||||
endif
|
endif
|
||||||
elseif has('win32')
|
elseif s:is_windows
|
||||||
let l:job_id = ale#job#StartWithCmd(l:command, l:job_options)
|
let l:job_id = ale#job#StartWithCmd(l:command, l:job_options)
|
||||||
else
|
else
|
||||||
let l:job_id = ale#job#Start(l:command, l:job_options)
|
let l:job_id = ale#job#Start(l:command, l:job_options)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Logic for handling mappings between files
|
" 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.
|
" Invert filesystem mappings so they can be mapped in reverse.
|
||||||
function! ale#filename_mapping#Invert(filename_mappings) abort
|
function! ale#filename_mapping#Invert(filename_mappings) abort
|
||||||
return map(copy(a:filename_mappings), '[v:val[1], v:val[0]]')
|
return map(copy(a:filename_mappings), '[v:val[1], v:val[0]]')
|
||||||
@@ -14,7 +16,16 @@ function! ale#filename_mapping#Map(filename, filename_mappings) abort
|
|||||||
let l:mapping_from = ale#path#Simplify(l:mapping_from)
|
let l:mapping_from = ale#path#Simplify(l:mapping_from)
|
||||||
|
|
||||||
if l:simplified_filename[:len(l:mapping_from) - 1] is# l:mapping_from
|
if l:simplified_filename[:len(l:mapping_from) - 1] is# l:mapping_from
|
||||||
return l:mapping_to . l:simplified_filename[len(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
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -192,6 +192,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['python'],
|
\ 'suggested_filetypes': ['python'],
|
||||||
\ 'description': 'Tidy Python imports with pyflyby.',
|
\ 'description': 'Tidy Python imports with pyflyby.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'unimport': {
|
||||||
|
\ 'function': 'ale#fixers#unimport#Fix',
|
||||||
|
\ 'suggested_filetypes': ['python'],
|
||||||
|
\ 'description': 'unimport fixer',
|
||||||
|
\ },
|
||||||
\ 'importjs': {
|
\ 'importjs': {
|
||||||
\ 'function': 'ale#fixers#importjs#Fix',
|
\ 'function': 'ale#fixers#importjs#Fix',
|
||||||
\ 'suggested_filetypes': ['javascript'],
|
\ 'suggested_filetypes': ['javascript'],
|
||||||
@@ -202,6 +207,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['puppet'],
|
\ 'suggested_filetypes': ['puppet'],
|
||||||
\ 'description': 'Run puppet-lint -f on a file.',
|
\ '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': {
|
\ 'remove_trailing_lines': {
|
||||||
\ 'function': 'ale#fixers#generic#RemoveTrailingBlankLines',
|
\ 'function': 'ale#fixers#generic#RemoveTrailingBlankLines',
|
||||||
\ 'suggested_filetypes': [],
|
\ 'suggested_filetypes': [],
|
||||||
@@ -452,6 +462,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['markdown'],
|
\ 'suggested_filetypes': ['markdown'],
|
||||||
\ 'description': 'Fix markdown files with pandoc.',
|
\ 'description': 'Fix markdown files with pandoc.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'pymarkdown': {
|
||||||
|
\ 'function': 'ale#fixers#pymarkdown#Fix',
|
||||||
|
\ 'suggested_filetypes': ['markdown'],
|
||||||
|
\ 'description': 'Fix markdown files with pymarkdown.',
|
||||||
|
\ },
|
||||||
\ 'shfmt': {
|
\ 'shfmt': {
|
||||||
\ 'function': 'ale#fixers#shfmt#Fix',
|
\ 'function': 'ale#fixers#shfmt#Fix',
|
||||||
\ 'suggested_filetypes': ['sh'],
|
\ 'suggested_filetypes': ['sh'],
|
||||||
@@ -667,6 +682,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['racket'],
|
\ 'suggested_filetypes': ['racket'],
|
||||||
\ 'description': 'Fix Racket files with raco fmt.',
|
\ 'description': 'Fix Racket files with raco fmt.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'rescript_format': {
|
||||||
|
\ 'function': 'ale#fixers#rescript_format#Fix',
|
||||||
|
\ 'suggested_filetypes': ['rescript'],
|
||||||
|
\ 'description': 'Official formatter for ReScript.',
|
||||||
|
\ },
|
||||||
\ 'ruff': {
|
\ 'ruff': {
|
||||||
\ 'function': 'ale#fixers#ruff#Fix',
|
\ 'function': 'ale#fixers#ruff#Fix',
|
||||||
\ 'suggested_filetypes': ['python'],
|
\ 'suggested_filetypes': ['python'],
|
||||||
@@ -747,6 +767,21 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['verilog'],
|
\ 'suggested_filetypes': ['verilog'],
|
||||||
\ 'description': 'Formats verilog files using verible.',
|
\ 'description': 'Formats verilog files using verible.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'markdownlint': {
|
||||||
|
\ 'function': 'ale#fixers#markdownlint#Fix',
|
||||||
|
\ 'suggested_filetypes': ['markdown'],
|
||||||
|
\ 'description': 'Fix markdown files with markdownlint.',
|
||||||
|
\ },
|
||||||
|
\ '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.
|
" Reset the function registry to the default entries.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function! ale#fixers#alejandra#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' -- -'
|
\ . ' -- -'
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function! ale#fixers#apkbuild_fixer#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable')
|
\ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable')
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function! ale#fixers#autoflake#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --in-place '
|
\ . ' --in-place '
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function! ale#fixers#autoimport#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'cwd': '%s:h',
|
\ 'cwd': '%s:h',
|
||||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' -',
|
\ . ' -',
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function! ale#fixers#autopep8#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' -',
|
\ . ' -',
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
function! ale#fixers#biome#Fix(buffer) abort
|
function! ale#fixers#biome#Fix(buffer) abort
|
||||||
let l:executable = ale#handlers#biome#GetExecutable(a:buffer)
|
let l:executable = ale#handlers#biome#GetExecutable(a:buffer)
|
||||||
let l:options = ale#Var(a:buffer, 'biome_options')
|
let l:options = ale#Var(a:buffer, 'biome_options')
|
||||||
let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--write --unsafe' : '--write'
|
let l:unsafe = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? ' --unsafe' : ''
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'command': ale#Escape(l:executable) . ' check '
|
||||||
\ 'command': ale#Escape(l:executable) . ' check ' . l:apply
|
\ . '--write --stdin-file-path %s' . l:unsafe
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t'
|
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function! ale#fixers#clangtidy#GetCommand(buffer) abort
|
|||||||
|
|
||||||
return ' -fix' . (l:fix_errors ? ' -fix-errors' : '')
|
return ' -fix' . (l:fix_errors ? ' -fix-errors' : '')
|
||||||
\ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks))
|
\ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks))
|
||||||
\ . (empty(l:extra_options) ? '' : ' ' . l:extra_options)
|
\ . ale#Pad(l:extra_options)
|
||||||
\ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir))
|
\ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir))
|
||||||
\ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options)
|
\ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options)
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function! ale#fixers#cmakeformat#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function! ale#fixers#dart_format#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' format'
|
\ . ' format'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function! ale#fixers#dartfmt#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' -w'
|
\ . ' -w'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function! ale#fixers#dfmt#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' -i'
|
\ . ' -i'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function! ale#fixers#dotnet_format#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' format'
|
\ . ' format'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --folder --include %t "$(dirname %t)"',
|
\ . ' --folder --include %t "$(dirname %t)"',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ function! ale#fixers#dune#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' format'
|
\ . ' format'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
\ . ale#Pad(l:options),
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function! ale#fixers#elm_format#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer))
|
\ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer))
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
\ . ale#Pad(l:options),
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function! ale#fixers#erblint#GetCommand(buffer) abort
|
|||||||
let l:options = ale#Var(a:buffer, 'eruby_erblint_options')
|
let l:options = ale#Var(a:buffer, 'eruby_erblint_options')
|
||||||
|
|
||||||
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
|
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --autocorrect --stdin %s'
|
\ . ' --autocorrect --stdin %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function! ale#fixers#fish_indent#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' -w '
|
\ . ' -w '
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function! ale#fixers#fourmolu#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': l:executable
|
\ 'command': l:executable
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --stdin-input-file '
|
\ . ' --stdin-input-file '
|
||||||
\ . ale#Escape(@%),
|
\ . ale#Escape(@%),
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Generic functions for fixing files with.
|
" 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
|
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort
|
||||||
let l:end_index = len(a:lines) - 1
|
let l:end_index = len(a:lines) - 1
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function! ale#fixers#gnatpp#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ function! ale#fixers#gofmt#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': l:env . ale#Escape(l:executable)
|
\ 'command': l:env . ale#Escape(l:executable)
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function! ale#fixers#goimports#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': l:env . ale#Escape(l:executable)
|
\ 'command': l:env . ale#Escape(l:executable)
|
||||||
\ . ' -l -w -srcdir %s'
|
\ . ' -l -w -srcdir %s'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ function! ale#fixers#golines#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': l:env . ale#Escape(l:executable)
|
\ 'command': l:env . ale#Escape(l:executable)
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function! ale#fixers#google_java_format#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' ' . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ' ' . ale#Pad(l:options)
|
||||||
\ . ' --replace'
|
\ . ' --replace'
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function! ale#fixers#hackfmt#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' -i'
|
\ . ' -i'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ function! ale#fixers#latexindent#Fix(buffer) abort
|
|||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . ' -l'
|
\ . ' -l'
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function! ale#fixers#luafmt#Fix(buffer) abort
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(l:executable)
|
\ 'command': ale#Escape(l:executable)
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . ale#Pad(l:options)
|
||||||
\ . ' --stdin',
|
\ . ' --stdin',
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user