Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Prefer ale_root option when detecting roots#4993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
w0rp wants to merge1 commit intomaster
base:master
Choose a base branch
Loading
fromcodex/update-ale-to-prefer-ale_root-setting

Conversation

@w0rp
Copy link
Member

Summary

  • addale#linter#GetRoot and use it when starting LSP linters
  • useale_root first inale#python#FindProjectRoot
  • update docs to describe the new root lookup behaviour
  • adjust tests and add new test for python root option

Testing

  • ./run-tests --fast(fails: docker not found)

https://chatgpt.com/codex/tasks/task_b_685c4b409780832aaeb2154798173c38

@w0rpw0rp marked this pull request as draftJune 25, 2025 20:07
@w0rpw0rp marked this pull request as draftJune 25, 2025 20:07
@w0rpw0rp requested a review fromCopilotJune 25, 2025 20:08
Copy link

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR introduces a unifiedale#linter#GetRoot function to prefer theg:ale_root/b:ale_root settings when detecting project roots, replaces legacy root-detection calls with it, and updates documentation and tests accordingly.

  • Addedale#linter#GetRoot and wired it into LSP and Python linters
  • Updated tests to cover the new root-lookup priority
  • Revised documentation (ale.txt,ale-python.txt) to describe the new behavior

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
autoload/ale/linter.vimNewGetRoot function that handlesale_root vars
autoload/ale/python.vimPython root lookup now usesGetRoot
autoload/ale/lsp_linter.vimRemoved oldFindProjectRoot, now callsGetRoot
autoload/ale/assert.vimAssertion helper updated to useGetRoot
ale_linters/python/pyright.vimUseGetRoot instead of LSP-specific finder
ale_linters/python/pylsp.vimDitto forpylsp
test/test_python_root_option.vaderNew tests for buffer/globalale_root behaviors
test/test_linter_defintion_processing.vaderUpdated tests to assertGetRoot is used
doc/ale.txtDocumentation ofg:ale_root updated
doc/ale-python.txtAdded note onale_root shortcut for Python

letl:Root=a:linter.project_root
returntype(l:Root)isv:t_func ?l:Root(a:buffer) :l:Root
endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

GetRoot currently returns an empty string by default when no root is found, which drops the fallback to a linter's existingproject_root_callback. Consider invokinga:linter.project_root_callback (viaale#util#GetFunction) when present to maintain the original behavior for linters that define callbacks.

Suggested change
ifhas_key(a:linter,'project_root_callback')
letl:Callback=ale#util#GetFunction(a:linter.project_root_callback)
iftype(l:Callback)isv:t_func
returnl:Callback(a:buffer)
endif
endif

Copilot uses AI. Check for mistakes.
@rymdbar
Copy link
Contributor

Problems, as well as confusion, with getting the correct project root happens often enough for this to warrant both a technical change such as the one in this pull-request and some updates to the documentation.

I might be confused myself and mixing contexts, but figure it's likely a good idea to add this quote of myself from#3481 here:

Adding a sentence or section to the documentation about the need for the for a project root to be found would likely be a good idea too. This might be a common theme applying to the documentation for most language servers.

Expecting everyone to have read :help ale-options.root and realise it is what is needed is probably unrealistic.

My mind is a bit fuzzy and my notes aren't making it crystal clear, but I think once the project roots are discovered the same way for all language servers, what needs to be done is to go through documentation for them all and make sure it mentions the requirement for a root to be found and the ability to hard code the root if desired.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@w0rp@rymdbar

[8]ページ先頭

©2009-2025 Movatter.jp