Commit Graph

4508 Commits

Author SHA1 Message Date
w0rp
0f71d4c494
Use ModeChanged events instead of InsertLeave emulation #4919 #4738
`ModeChanged` looks like a more reliable way to detect an "exit insert mode" event and is a lot simpler (doesn't need a timer). Also, it can detect some other transitions like `\<C-o\>` in insert mode.
The `ModeChanged` event is available in:

* [Vim 8.2.3430](f1e8876fa2)
* [NeoVim 0.7.0](69bd1e4e36)

---------

Co-authored-by: Dmitry Zolotukhin <zlogic@gmail.com>
2025-03-10 21:28:20 +00:00
Vivian De Smedt
3611c32d60
Add support for the [djlinter](https://www.djlint.com/) (#4909)
* Add support for the [djlinter](https://www.djlint.com/)

* Add documentation and tests.

* Fix the name of the variable for the executable name.

* Correct the name of the handler in the test.

* Correct the test adding the value of vcol.

* Format djlint.vim according to formatting rules.
2025-03-08 16:45:17 +09:00
Alexander Huynh
a6db6c95a6
more defensive coding: guard against a non-iterable loclist (#4912)
Sometimes `s:HandleExit` can execute a deferred linter callback, which
ends up setting the `l:loclist` that's passed into
`ale#engine#HandleLoclist` at the end of `s:HandleExit` to a dictionary.
This dictionary cannot be iterated over, and thus errors out.

Guard against trying to iterate over values that don't make sense.

Co-authored-by: Alexander Huynh <git@e.sc>
2025-03-08 16:44:43 +09:00
Horacio Sanson
7882fb9811
Fix 4913 - use JSON output for golangci-lint instead of regexps. (#4917)
* Fix 4913 - use JSON output for golangci-lint instead of regexps.

* Check for empty array
2025-03-07 22:02:49 +09:00
Noah
e319d48941
Fixed the issue with Black ignoring config file to tell it which file is being processed. (#3406) (#4894)
* Fixed the issue with Black ignoring files is being processed. (#3406)

Add test for stdin-filename on test/fixers/test_ruff_format_fixer_callback.vader

* Fixed the issue with Black ignoring files is being processed. (#3406)
Fixed the problem on Windows's tests.

* Fixed the issue with Black ignoring config file to tell it which file is being processed. Trailing whitespace removed
2025-02-24 11:36:56 +09:00
David Briscoe
d38a3f7739
Add fixer for json: python's json.tool (#4847)
Resolves #4314.

Add a fixer that's built into python for json formatting. Include a
couple arguments in docs to make these features more discoverable.

Uses stdin-based fixing so you don't need to save the file to fix.
2025-02-24 11:30:43 +09:00
Jim Keener
699c0dbe80
iverilog current file search path (#4907)
In the vein of commit ea72d66b "Verilator current file search path (#3500)"

This includes the directory of the current file in the library
search path. From `man iverilog`:

           -ylibdir
               Append  the  directory  to the library module search
               path. When the compiler finds an undefined module, it
               looks in these directories for files with the right name.
2025-02-16 10:38:30 +09:00
Bogdan Gusiev
ce2b002c03
Add matched text to ALEFindReferences -quickfix for tsserver (#4898)
* Add matched text to ALEFindReferences -quickfix for tsserver

* Update autoload/ale/references.vim
2025-02-16 10:16:01 +09:00
Takahito Nakano
e5d6d94f71
Fix cwd setting to use .stylua.toml if stylua.toml is not found (#4892) 2025-02-07 18:19:05 +09:00
Kevin Quinn
62af9f2650
fix: memory-limit option for phpstan (#4900)
This might only be a problem for newer phpstan versions (2.1.1 here).

If you try to run `phpstan` the way ale will when it builds the option, you will get something like:

```
The "--memory-limit" option requires a value.
```

It wants you to use `--memory-limit=-1` instead.
2025-02-07 18:12:54 +09:00
dcai
305e1c2fb1
fix(biome): update biome fixer supports css and graphql (#4902)
Co-authored-by: dcai <dongsheng.cai@iag.com.au>
2025-02-07 17:48:58 +09:00
dcai
6c337ad19c
fix: stylua should have cwd and --stdin-filepath (#4873) 2025-01-10 13:35:30 +09:00
Vangelis
83ec182bdf
xmllint fixer must read from stdin - not buffer filename (#4884)
The current xmllint fixer reads and formats the file that a buffer is
associated with from disk instead of accepting input from stdin. This
has the side effect that if the filename is changed in the buffer, but
not saved yet, the fixer discards all the pending changes and replaces
the buffer contents with the formatted text from the file contents on
disk.
2025-01-10 13:34:56 +09:00
konimarti
3ca2a9ea3c
Add support for c3-lsp linter (#4836)
* Add support for c3-lsp linter

Add support for c3-lang with the c3-lsp language server.

Link: http://github.com/pherrymason/c3-lsp
Link: http://c3-lang.org

* fix linter error

* fix: consistent use of the executable name

Consistently use the executable name 'c3lsp' instead of the project name
'c3-lsp'.

* c3lsp: add command line arguments to executable
2025-01-10 13:34:29 +09:00
Dmitri Vereshchagin
0551602b19
Add erlfmt fixer to the registry and use it with stdin (#4868)
* Add erlfmt fixer to the registry

Without this, the fixer will not appear in the list of suggested tools
and cannot be used without additional configuration.

* Handle stdin in the erlfmt fixer command

Previously, the full path to the file being edited was used, which
resulted in the loss of unsaved changes.

* Add executable selection tests for erlfmt fixer
2024-12-29 13:55:43 +09:00
Logan
c9df465148
Add podman to launch test (#4882)
Users can set the DOCKER environnement variable to select Docker or
Podman to run the tests.

Co-authored-by: L'HOSPITAL Logan <lhospitallogan@gmail.com>
2024-12-29 13:42:04 +09:00
Hugo
d69f8fed73
Implement support for apkbuild-fixer (#4881)
I am not the author of a single file, but have full permissions from the
original author for permission for submitting this to ALE under the
2-Clause BSD licence.

See: https://gitlab.alpinelinux.org/Leo/apkbuild.vim/-/issues/3
2024-12-29 13:37:33 +09:00
axhav
e82fd24943
Add yq support (#4861)
* Added jq support

Cleaned up yq.vim file

* Updated docs

* Updated supported-tools.md

* Added yq tests

* Fix python linting/formatting error when in virtual environment (#4865)

Python fixers and linters were failing when vim is running in a virtual
environment that's located in a path containing text `poetry`. The cause
of this was the regular expression `poetry\|pipenv\|uv$` which matches
`poetry` and `pipenv` if they appear anywhere in the virtualenv path.

* Add cljfmt fixer for clojure files (#4860)

* When using `actionlint` look for & use a config file (#4858)

Actionlint supports a config file and it lives in a very searchable
path, as the only files it acts on are in the `.github` directory
already.

Look for an `actionlint.yml` and `.yaml` in that path, and use the
config if its there.

* Fix linting with jq (#4765) (#4862)

With the 1.6 version of jq the error message start with "parse error".
With the last version of jq the error message start with "jq: parse error".
Fix it by using a regular expression that works in both cases.

* Properly handle optional end_line_no/end_line_pos in sqlfluff (#4867)

end_line_no/end_line_pos are optional. Example SQL:
`SELECT NULL FROM {{ a_jinja_templated_table }};`

`sqlfluff lint --dialect ansi --format json` gives the following error
among others:
```
{"start_line_no": 1, "start_line_pos": 21, "code": "TMP", "description":
"Undefined jinja template variable: 'a_jinja_templated_table'", "name":
"", "warning": false}
```

As one can see there is no end_line_no/end_line_pos.

* Add golangci-lint fixer (#4853)

Closes #4616

* Fixed copy-paste misstakes and added filter to docs

* Added test vader file for yq

* Fixed and updated the test case

---------

Co-authored-by: Walter Kaunda <14844142+kwalter94@users.noreply.github.com>
Co-authored-by: rudolf ordoyne <49649789+casens5@users.noreply.github.com>
Co-authored-by: Bea Hughes <108035665+beahues@users.noreply.github.com>
Co-authored-by: benjos1234 <legrimlvl24@gmail.com>
Co-authored-by: Coacher <Coacher@users.noreply.github.com>
Co-authored-by: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
2024-12-29 13:36:18 +09:00
Robert Muir
5b2e69ae61
fix ale_python_auto_virtualenv to correctly set virtualenv env vars (#4885)
* fix ale_python_auto_virtualenv to correctly set virtualenv env vars

According to the documentation, `ale_python_auto_virtualenv` should automatically set environment variables for commands, but previously the variables were not set completely or correctly.

Before:
  `PATH` variable was expanded to include `/path/to/venv`
After:
  `PATH` variable is expanded to include `/path/to/venv/bin`
  `VIRTUAL_ENV` variable is set to `path/to/venv`

This mimics exactly what the `activate` scripts do, and allows the configuration knob to work as expected.

For example, after this change, `jedi-language-server` can be installed globally (instead of inside every venv), and it will "just work" (e.g. find references to dependencies in the venv) when editing a file in a project that uses a venv, because the correct variables are set.

* fix test_python_virtualenv.vader test to expect output with both virtualenv vars

* remove unnecessary non-escape in test_python_virtualenv.vader

* fix accidentally removed space in windows test_python_virtualenv.vader
2024-12-29 13:35:28 +09:00
Benjamin Bannier
6e4f01f6d1
Surface warnings from Zeek linter (#4883)
In addition to errors Zeek's parsing can also expose warning messages,
e.g., for the following code

```zeek
event http_stats(c: connection, stats: http_stats_rec) {
    c$removal_hooks;
}
```

a warning is emitted

```
warning in /tmp/foo.zeek, line 2: expression value ignored (c$removal_hooks)
```

This patch adds parsing and propagation of these warning messages.
2024-12-29 13:07:00 +09:00
Ian Stapleton Cordasco
65b49c1b81
Add golangci-lint fixer (#4853)
Closes #4616
2024-11-27 22:17:31 +09:00
Coacher
0ef2c455ee
Properly handle optional end_line_no/end_line_pos in sqlfluff (#4867)
end_line_no/end_line_pos are optional. Example SQL:
`SELECT NULL FROM {{ a_jinja_templated_table }};`

`sqlfluff lint --dialect ansi --format json` gives the following error
among others:
```
{"start_line_no": 1, "start_line_pos": 21, "code": "TMP", "description":
"Undefined jinja template variable: 'a_jinja_templated_table'", "name":
"", "warning": false}
```

As one can see there is no end_line_no/end_line_pos.
2024-11-27 22:17:02 +09:00
benjos1234
9d30fb2f59
Fix linting with jq (#4765) (#4862)
With the 1.6 version of jq the error message start with "parse error".
With the last version of jq the error message start with "jq: parse error".
Fix it by using a regular expression that works in both cases.
2024-11-23 18:42:22 +09:00
Bea Hughes
1e1604be56
When using actionlint look for & use a config file (#4858)
Actionlint supports a config file and it lives in a very searchable
path, as the only files it acts on are in the `.github` directory
already.

Look for an `actionlint.yml` and `.yaml` in that path, and use the
config if its there.
2024-11-19 11:40:56 +09:00
rudolf ordoyne
defb0ea336
Add cljfmt fixer for clojure files (#4860) 2024-11-17 11:22:36 +09:00
Walter Kaunda
5cc6b933b1
Fix python linting/formatting error when in virtual environment (#4865)
Python fixers and linters were failing when vim is running in a virtual
environment that's located in a path containing text `poetry`. The cause
of this was the regular expression `poetry\|pipenv\|uv$` which matches
`poetry` and `pipenv` if they appear anywhere in the virtualenv path.
2024-11-17 11:00:55 +09:00
Dmitri Vereshchagin
898638abe5
Add erlang-ls as an alias for erlang_ls linter (#4852)
The project itself is often referred to as Erlang LS, so erlang-ls would
be a suitable alias.
2024-11-09 15:51:54 +09:00
Dmitri Vereshchagin
4fca3824cc
Add erlang-mode fixer for Erlang files (#4848)
This fixer performs indentation with the Erlang mode for Emacs.
The Erlang mode is maintained in the Erlang/OTP source tree.  It indents
some things differently than the Vim indent plugin, and provides more
customization options.
2024-10-31 21:29:59 +09:00
Dmitri Vereshchagin
d82d968f8a
Set two-space indent for *.vader in .editorconfig (#4849)
Will be useful for those who use an EditorConfig plugin.
2024-10-31 21:28:44 +09:00
Krishnansh Agarwal
9854e19fa9
Update metals.vim (#4843)
The binary installed by `cs install metals` is called `metals`, not `metals-vim`

Please fix this !
2024-10-20 00:19:18 +09:00
Friedrich C. Kischkel
02eb9984b1
Make documentation more consistent with Vim's own :help (#4840)
* Prefix user-defined commands with colons

This is consistent with Vim's own :help pages.

* Remove dot hack

Now that we have `:ALEInfo` and `ALEInfo`, we don't need `ALEInfo.` any
more to disambiguate them.

* Use colons in references

* Use angle brackets for command arguments

* Use `:Command` for command references

* Use a non-command reference for tsserver

* Prefix highlight references with hl-

* Fix some references into Vim's own :help

E.g. location-list or +features

* Misc hotlink improvements

* Undo previous changes to tsserver

Just leave it in backticks - even though I don't like it.

* Use bars for a command for consistency

* Append hotlinks to hl-groups

Remove minuses to make tables look more like in Vim's own :help

* Prefix features with +

* Provide full hotlink to ale.txt

* Fix double pipe typo

* Capitalize Error highlight

There seems to be no hotlink in Vim's own documentation for this.
I would have expected *hl-Error* - no such thing :-(

* Right align tags to col 79
2024-10-20 00:18:24 +09:00
David Briscoe
0b4c665840
Return floating_preview window id (#4828)
Make ale#floating_preview#Show more similar to popup_create and return
the id of the window so it's easy to set the filetype of the resulting
buffer.

Update test stub version of Show() to return a win id (the current window
since it's not actually creating a window).

Test
* both tests still pass
2024-10-20 00:13:50 +09:00
Markus
2e5f135836
no need to write and read temporary file with syntax_tree (#4834) 2024-10-14 11:45:41 +09:00
Diego Henrique Oliveira
a7ef1817b7
Improve support for python package manage: pipenv, poetry and uv (#4825) 2024-09-05 15:37:30 +09:00
ghsang
954682108d
Add support for astro (#4780)
* feat: prettier for astro
* feat: eslint for astro
* feat: doc for astro
2024-08-14 08:24:22 +01:00
Dmitri Vereshchagin
48d73c87c3
Refactor SyntaxErl linter file (#4807) 2024-07-12 09:40:38 +09:00
Braden Kelley
5c635d5038
feat(biome): add support for json and jsonc (#4805)
- adds biome linter for json and jsonc
- enables biome by default for json and jsonc
- suggests biome as a fixer for json and jsonc
2024-07-09 09:41:17 +09:00
w0rp
3220b94d20
Fix #4714 - Handle ruff garbage
When ruff outputs errors are invalid JSON text, handle that and stop ALE
from throwing exceptions.
2024-07-08 03:22:46 +01:00
Tom Bourton
a35fa4d732
When ruff version is >=0.5.0 use 'ruff check <path>' instead of 'ruff <path>' (#4802) 2024-07-02 16:43:02 +09:00
Braden Kelley
a0ad5f938a
fix!(biome): allow passing options to biome check (#4799)
The only option available to biome's `lsp-proxy` command used for
linting is `--config-path`. However, we are using ALE to find and set
the project root, and have a way to manually override, so that is no
longer necessary.

The LSP proxy also used the `g:ale_biome_options` config, which is
shared with the fixer's `check` command, but `lsp-proxy` will throw an
error if unknown options are included, making it so that option is only
useful to set the project root.

BREAKING CHANGE: We are no longer passing options to the biome LSP
proxy, but we can still set the project root with
`g:ale_biome_lsp_project_root`.
2024-06-27 14:30:06 +09:00
Braden Kelley
ed0b036220
fix(biome): find root when using biome.jsonc (#4774)
Since biome supports either `biome.json` or `biome.jsonc` config files,
we need to look for both when searching for the LSP project root. We can
also look for a package.json or .git folder to use. This uses mostly the
same logic as deno.
2024-06-25 17:18:28 +09:00
Loic Nageleisen
e09520e2d7
Add Ruby linter with Steep (#4671)
* Add Ruby linter with Steep

Fixes #3254

* Run steep instead of using language server

LSP presents a few issues and this works around those.

* Work around Steep path issue

See https://github.com/soutaro/steep/pull/975

* Add simple tests for steep

* Add steep to supported tools

* Pass linter

* Add a comment regarding Steep's column counting

* Make lnum an integer

* Add Steep handler test

* Fix separator for Windows

* Escape Windows path separators for substitute()

* Use ALEInfo (I) group

* Use fnameescape instead of quotes

* Skip linting for files not under steep root

* Add and pass tests covering proper steep root lookup

* Fix separator discrepancy

* Use strict operators (match case)

* Fix ordering

* Use `is#` instead of `==#`
2024-06-25 17:17:27 +09:00
Alexey Vazhnov
f4bc3c2711
README.md: fix typo: there should be a comma (#4797) 2024-06-24 06:34:34 +01:00
Braden Kelley
5606606b32
fix(biome): send correct language to lsp proxy (#4773)
Since Biome understands `typescriptreact` and `javascriptreact` as
languages, we can send the `filetype` to the LSP, rather than only
sending `typescript` for both `ts` and `tsx` files, or `javascript` for
`js` and `jsx` files.

fixes: #4752
2024-06-24 06:32:24 +01:00
Braden Kelley
f2aef2f510
fix(biome): run all enabled biome fixers (#4763)
- based on biome config, will format, lint, and/or sort imports
- adds variable to apply unsafe fixes, disabled by default

fixes: #4754
2024-06-21 09:21:19 +09:00
Braden Kelley
0cd64c87bf
fix(biome): use temp file instead of stdin (#4775)
biome handles utf8 characters differently between files and stdin, and
in some cases can replace emojis with ascii characters when using stdin

refs: biomejs/biome#2604
2024-06-21 08:19:55 +09:00
w0rp
c7c41e1574
Run actionlint by default on GitHub files
Detect paths containing .github as a directory for running actionlint
by default on YAML filetypes.
2024-06-02 19:07:06 +01:00
ghsang
adaa7f6f62
Fix eslint cwd strategy (#4781)
Change eslint cwd to follow configuration file paths.
2024-05-31 09:30:37 +02:00
Macuyler Dunn
c88bddfa83
Update dart analysis_server command (#4761)
* Update dart analysis_server command

In 2021 the dart team added a new sub-command `language-server` to
replace the original `./snapshots/analysis_server.dart.snapshot --lsp`
convention for starting the language server.

c224cc2e0d

* Add ale_dart_analysis_server_enable_language_server option

This allows users to opt-in to the new `dart language-server` command.

* Enable ale_dart_analysis_server_enable_language_server option by default

* Update doc/ale-dart.txt

Include the dart version number where the `dart language-server` command
was added.
2024-05-09 10:58:16 +09:00
Bryan Garber
70eeae54fb
Implement listing all returned results for LSP textDocument/implements (#4755)
* Fix list of definitions
* Fix when LSP returns single response on definition/implementation
* Update tag stack on ShowSelection
2024-05-01 11:58:06 +01:00