mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Fix #4388: Fix pylsp and Pyright cwd
Add functions to compute the cwd to be the same as the project root for pylsp and Pyright to work around issues in each language server when they encounter modules that share the same name as first or third party libraries.
This commit is contained in:
@@ -10,6 +10,8 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The pylsp command callback should return default string):
|
||||
call ale#test#SetFilename('./foo.py')
|
||||
|
||||
AssertLinter 'pylsp', ale#Escape('pylsp')
|
||||
|
||||
Execute(The pylsp executable should be configurable):
|
||||
@@ -22,6 +24,12 @@ Execute(The pylsp command callback should let you set options):
|
||||
|
||||
AssertLinter 'pylsp', ale#Escape('pylsp') . ' --some-option'
|
||||
|
||||
Execute(The cwd and project root should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertLinterCwd ale#test#GetFilename('../test-files/python/with_virtualenv/subdir')
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/python/with_virtualenv/subdir')
|
||||
|
||||
Execute(The pylsp executable should be run from the virtualenv path):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The pyre command callback should return default string):
|
||||
call ale#test#SetFilename('./foo.py')
|
||||
|
||||
AssertLinter 'pyre', ale#Escape('pyre') . ' persistent'
|
||||
|
||||
Execute(The pyre executable should be configurable):
|
||||
|
||||
@@ -10,6 +10,8 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The command callback should return the correct default string):
|
||||
call ale#test#SetFilename('./foo.py')
|
||||
|
||||
AssertLinter
|
||||
\ 'pyright-langserver',
|
||||
\ ale#Escape('pyright-langserver') . ' --stdio'
|
||||
@@ -30,6 +32,12 @@ Execute(The default configuration should be mostly empty):
|
||||
|
||||
AssertLSPConfig {'python': {}}
|
||||
|
||||
Execute(The cwd and project root should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertLinterCwd ale#test#GetFilename('../test-files/python/with_virtualenv/subdir')
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/python/with_virtualenv/subdir')
|
||||
|
||||
Execute(virtualenv paths should be set in configuration by default):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user