Heyward Fann, aka fannheyward, a developer based in Beijing, China.
fannheyward / coc-pyright Goto Github PK
View Code? Open in Web Editor NEWPyright extension for coc.nvim
License: MIT License
Pyright extension for coc.nvim
License: MIT License
When open a python file after installed coc-pyright, the below error happened.
[coc.nvim]Error on active extension coc-pyright: Error: [UriError]: Scheme is missing: {scheme: "", authority: "", path: "/Users/yang/workspace/python-web-api-demo", query: "", f
ragment: ""}
at _validateUri (/Users/yang/.dotfiles/dotconfig/nvim/viml/plugins/coc.nvim/build/index.js:21241:19)
at _URI.URI (/Users/yang/.dotfiles/dotconfig/nvim/viml/plugins/coc.nvim/build/index.js:21343:13)
at new _URI (/Users/yang/.dotfiles/dotconfig/nvim/viml/plugins/coc.nvim/build/index.js:21545:47)
at Function.URI.parse (/Users/yang/.dotfiles/dotconfig/nvim/viml/plugins/coc.nvim/build/index.js:21455:16)
at Configurations.getFolderConfiguration (/Users/yang/.dotfiles/dotconfig/nvim/viml/plugins/coc.nvim/build/index.js:24122:34)
at Configurations.getConfiguration (/Users/yang/.dotfiles/dotconfig/nvim/viml/plugins/coc.nvim/build/index.js:24045:84)
at Workspace.getConfiguration (/Users/yang/.dotfiles/dotconfig/nvim/viml/plugins/coc.nvim/build/index.js:22570:36)
at PythonSettings.initialize (/Users/yang/.config/coc/extensions/node_modules/coc-pyright/lib/index.js:3298:52)
at new PythonSettings (/Users/yang/.config/coc/extensions/node_modules/coc-pyright/lib/index.js:3146:14)
at Function.getInstance (/Users/yang/.config/coc/extensions/node_modules/coc-pyright/lib/index.js:3153:30)
Trying to create a stubs file for pandas:
:CocCommand pyright.createtypestub pandas
[coc.nvim] An error occurred when creating type stub for 'pandas': No typings path was specified
[coc.nvim] error: UnhandledRejection: Request workspace/executeCommand failed unexpectedly without providing any details.
Error: Request workspace/executeCommand failed unexpectedly without providing any details.
at handleResponse (/home/felipemarcelino/.config/nvim/plugged/coc.nvim/build/index.js:15819:48)
at processMessageQueue (/home/felipemarcelino/.config/nvim/plugged/coc.nvim/build/index.js:15646:1
7)
at Immediate. (/home/felipemarcelino/.config/nvim/plugged/coc.nvim/build/index.js:15630
:13)
at processImmediate (internal/timers.js:445:21)
When running the command-line pyright on
import numpy
numpy.sqrt(5.0)
I correctly get
No configuration file found.
stubPath /tmp/typings is not a valid directory.
Assuming Python platform Linux
Searching for source files
Found 1 source file
0 errors, 0 warnings, 0 infos
Completed in 0.635sec
When using coc-pyright, I get
[Pyright (reportGeneralTypeIssues)] [E] "sqrt" is not a known member of module
A bug?
class Test:
def method1(self, param1):
pass
def method2(self, param1):
pass
If you write self.method2(
in method1 it will show autocomplete up until the parenthesis, but the signature help won't show up and this shows in CocOpenLog:
2020-12-07T20:53:48.491 WARN (pid:51074) [Handler] - signature help provider not found!
However if you go to method2 and write self.method1(
the signature help works just fine, and in vscode with pylance both cases work (which I guess is using the same pyright backend for this).
I'm trying to use coc-pyright but after installing and opening a python file I get the following:
[coc.nvim] The "pyright" server crashed 5 times in the last 3 minutes. The server will not be restarted.
The output is the following message repeated several times:
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'worker_threads'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.5013 (/home/marco/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:1:561)
at s (/home/marco/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:1:687)
at Object.8863 (/home/marco/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-internal.js:1:801994)
at s (/home/marco/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:1:687)
at Object.5822 (/home/marco/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:1:46)
at s (/home/marco/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:1:687)
CocInfo:
vim version: NVIM v0.5.0-823-g42ffa2d62
node version: v10.19.0
coc.nvim version: 0.0.79-bd91ae4254
coc.nvim directory: /home/marco/.config/nvim/plugged/coc.nvim
term: xterm-256color
platform: linux
Am I missing something?
This plugin marks unused variables, hovewer, reportUnusedVariable is disabled by default.
Like in this example:
def test(param):
pass
i tried to disable it by adding this to CocConfig:
"python.analysis.diagnosticSeverityOverrides": {
"reportUnusedVariable": "none"
},
But it does not works.
Does this looks like plugin problem, or maybe i should create issue in pyright repo?
Thank you for the plugin. I am wondering if there is a way to change the root pattern? Or at least a way to look at what the root pattern is?
Thanks again.
Whenever I call :CocAction, I get told that there are no code actions available - not even general ones such as sorting imports or formatting. Is this intended? I've tried reinstalling several times but with no change. I'm in the process of switching from coc-python to coc-pyright - so far I've found it to be great, aside from this
Can you give a bit instruction on how to use pyright's auto import feature with coc-pyright?
coc-pyright is unable to resolve imports when importing a local file, such as
# main.py
from test import *
(both main.py
and test.py
are in the same directory)
I can use venv
property in pyrightconfig.json
. Is there an equivalent Coc configurations, like python.venv
or something?
Hi there,
I use coc-python for completion and coc-pyright for linting. I disabled completion for coc-pyright to circumvent duplicate completion items. However, pyright.disableLanguageServices seems to get ignored.
I tested multiple versions, and it breaks at 1.0.82. Version 1.0.81 shows no duplicates and 1.0.82 does.
Cheers,
Hans
Hi!
Pyright added support for workspaceSymbols (e.g. CocList symbols), though only "outline" is available from within coc. Otherwise I find that coc-pyright already quite suitably can replace coc-python, especially since the LSP starts a lot faster :)
Many thanks for your work on the plugin and consideration!
Steps:
call plug#begin('~/.config/nvim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
PlugInstall
and CocInstall coc-pyright
.nvim /tmp/test.py
,pyright still not work.Originally posted by @DedSecer in #82 (comment)
I'm migrating from coc-python, and I have this in my global config file
"python.venvPath":"~/.virtualenvs",
Previously this worked, but now I see the following message in the pyright output:
[Error - 12:17:32] venvPath /home/ash/code/airflow/airflow/~/.virtualenvs is not a valid directory.
I also tried with $HOME
, neither worked.
Please could one of these expansion mechanisms work before the config is passed on to pyright?
darker
, a wrapper for black
that allows reformatting regions of a file, has support for Visual Studio, but the configuration doesn't work because coc-pyright throws this error:
[coc.nvim] Black does not support the "Format Selection" command
I use coc-python + coc-pyright
.
"Rename" doesn't work if coc-pyright is installed.
An error message [coc.nvim] Invalid position for rename
is displayed.
"Rename" works when coc-pyright is uninstalled.
vim version: NVIM v0.5.0-340-gd3a9d75c0
node version: v12.13.1
coc.nvim version: 0.0.74
term: iTerm.app
platform: darwin
...snip
"python.jediEnabled": false,
...snip
"pyright.disableLanguageServices": true,
"pyright.openFilesOnly": true,
...snip
Hi,
I noticed that in this image from your README has different colours for [E] and [H]. I was wondering how you achieved that.
Docstrings for third-party libraries and custom functions work. Would it be possible to reallow builtin functions (e.g. print
) to also display docstrings?
See here for more information: microsoft/pylance-release#49
EDIT: Whoops, I meant to raise this issue in the pyright repository. Please close if it's not relevant.
CocConfig:
{
"python.autoComplete.extraPaths": [
"/home/thib/catkin_ws/devel/lib/python3/dist-packages",
"/home/thib/main/svpy",
],
"python.analysis.extraPaths": [
"/home/thib/catkin_ws/devel/lib/python3/dist-packages",
"/home/thib/main/svpy",
]
}
When importing modules from outside the working project, the following import error shows up:
from sv_msgs.msg import PickupZoneArray, PickupZone
[Pyright (reportGeneralTypeIssues)] [E] "PickupZoneArray" is unknown import symbol
When importing modules from within the working project, the following error import shows up:
from pymongo.database import Database
[Pyright (reportMissingImports)] [E] Import "pymongo.database" could not be resolved
coc-python
works without issue with the right python.autoComplete.extraPaths
. But somehow coc-pyright
ignore those extra paths.
Hi!
Would it be possible to be able to set the python.analysis.extraPaths
option, it seems to be available in pyright? The option is also available in coc-python, but is listed under autoComplete
instead of analysis
.
This is useful when your projects are not on the pythonpath per se.
I want to use two different virtualenvs, one for pyright utils like formatting, linting etc. and different for each project, so i in init.vim
i set let g:python3_host_prog = '/home/user/.virtualenvs/nvim/bin/python'
as base env named nvim, activate it, then add a pyrightconfig.json
with {"venvPath": "/home/user/.virtualenvs", "venv": "proj-venv"}
. When open project files pylint shows import errors on third party libs, but all pyright functionality works. If mix both virtualenvs and install all project requirements on nvim virtualenv the problem is solved, but it's not a clean solution.
I just use pyright's goto definition and goto reference, so I try to set "python.linting.enabled": false in coc-settings.json, but this setting do not work
{ "python.linting.enabled": false, }
Is there need for using minimization webpack feature?
It is not used in browser, and it's hard to debug it with minimization enabled.
could not import '<module>'
in CocInfo
. What does that mean?Example for part of the log:
Could not import 'PIL' in file '/var/src/beets/beets/util/artresizer.py'
Looking for typeshed stdlib path
Attempting to resolve using root path '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.7'
Could not find directory '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.7/PIL'
Did not find file '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.7/PIL.pyi', '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.7/PIL.py' or '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.7/PIL.pyd'
Attempting to resolve using root path '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.6'
Could not find directory '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.6/PIL'
Did not find file '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.6/PIL.pyi', '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.6/PIL.py' or '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3.6/PIL.pyd'
Attempting to resolve using root path '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3'
Could not find directory '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3/PIL'
Did not find file '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3/PIL.pyi', '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3/PIL.py' or '/home/doron/.config/coc/extensions/node_modules/coc-pyright/typeshed-fallback/stdlib/3/PIL.pyd'
Hi!
I'm using now the coc-python but I feel it has a lack of linting support.
But the pyright seems do not have formatting or something else.
Is there any way to use coc-python and coc-pyright both?
I use conda as my python env manager...and I want know which conda env I used now...So I want to know how I set coc-pyright that current python env can be show on the lightline... call coc#status()
seems no thing happen...
pdData.head()出错 Cannot access member 'head' for type 'TextFileReader'
但是在命令行下运行 python 3.8 后,逐条语句输入就没有错误。
python.setInterpreter doesn't work for me, heres the problem:
if I have python.pythonPath in my coc config, I can't change the intrepreter when I want to use a virtual environment,
to solve this, I removed python.pythonPath from coc config and now I can use my venv interpreter, but now I can't use pyright outside of my project, cause I removed python.pythonPath from coc config and now pyright has no interpreters to work with,
so I put it back in the coc config file, now it works fine out of projects, but in the projects? it doesn't know my imports ( cause they are installed in a venv ) and python.setInterpreter doesn't work AT ALL.
I'll try to record my screen to show it...
with the following configuration:
{
"coc.preferences.formatOnSaveFiletypes": [
"css",
"markdown",
"javascript",
"graphql",
"html",
"yaml",
"json",
"python"
],
// python config
"coc.source.vimtex.enable": true,
"coc.preferences.extensionUpdateCheck": "daily",
"python.pythonPath": "",
"pyright.disableLanguageServices": false,
"suggest.enablePreview": true,
"diagnostic.virtualText": true,
"diagnostic.virtualTextCurrentLineOnly": false,
"python.formatting.provider": "black",
"codeLens.enable": true,
"python.linting.enabled": true,
"python.linting.pylintArgs": [
"--load-plugins",
"--rcfile",
"~/.pylintrc",
"-d",
"C0411"
],
"python.formatting.blackPath": "",
"python.venvPath": "",
"python.linting.pylintUseMinimalCheckers": false,
"python.linting.pylintPath": "pylint",
"snippets.ultisnips.directories": [
"UltiSnips",
"~/.config/nvim/utils/snips"
]
}
The black and sort on save are not working. Any suggestions?
coc-pyright
at the moment doesn't support formatting. From what I understand, pyright
itself doesn't support formatting, but pylance
does using vscode-python
. Maybe you can take a look and see if it's possible to implement the functionality in coc-pyright
. Thank you!
我发现我项目中写了某写模块,必须手动export PYTHONPATH到那个包的地址才行,否则import 就会提示错误。
而且还有一个问题,虚拟环境可以配置相对地址嘛。一般都是项目根路径下的某个文件夹
I've configured coc-pyright
with:
call coc#config('pyright', {
\ 'disableLanguageServices': v:true
\ })
Because I'm trying to use it with coc-python, but now I don't get signatureHelp from either place.
When I try to use coc-pyright (with our without coc-python) I get the following eerror:
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'worker_threads'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at eval (webpack://pyright-server/external_%22worker_threads%22?:1:18)
at Object.worker_threads (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3803:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
at eval (webpack://pyright-server/./src/server.ts?:19:26)
at Object../src/server.ts (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:2295:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
[Info - 11:59:00 AM] Connection to server got closed. Server will restart.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'worker_threads'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at eval (webpack://pyright-server/external_%22worker_threads%22?:1:18)
at Object.worker_threads (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3803:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
at eval (webpack://pyright-server/./src/server.ts?:19:26)
at Object../src/server.ts (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:2295:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
[Info - 11:59:00 AM] Connection to server got closed. Server will restart.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'worker_threads'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at eval (webpack://pyright-server/external_%22worker_threads%22?:1:18)
at Object.worker_threads (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3803:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
at eval (webpack://pyright-server/./src/server.ts?:19:26)
at Object../src/server.ts (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:2295:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
[Info - 11:59:00 AM] Connection to server got closed. Server will restart.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'worker_threads'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at eval (webpack://pyright-server/external_%22worker_threads%22?:1:18)
at Object.worker_threads (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3803:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
at eval (webpack://pyright-server/./src/server.ts?:19:26)
at Object../src/server.ts (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:2295:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
[Info - 11:59:00 AM] Connection to server got closed. Server will restart.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'worker_threads'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at eval (webpack://pyright-server/external_%22worker_threads%22?:1:18)
at Object.worker_threads (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3803:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
at eval (webpack://pyright-server/./src/server.ts?:19:26)
at Object../src/server.ts (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:2295:1)
at __webpack_require__ (/Users/david.maia/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/pyright-langserver.js:3826:42)
[Error - 11:59:00 AM] Connection to server got closed. Server will not be restarted.
I work with a large code base (apache/airflow) and workspaceSymbols :CocList -I symbols
is very slow, and I pay that cost each time I have to use it.
I'm not sure if this is issue belongs here or in pyright itself, but I was wondering if there is some option so this could be cached?
Hi, as I mentioned in this issue, the pyright is producing reportMissingImports warning when I am trying to import anything from my own django apps.
I believe the issue is related to where my project root is set.
below is my working directory.
project (this is what pyright thinks the cwd is)
| -- django_project (this should be the cwd)
| | -- manage.py
| | -- Pipfile
| | -- my_app
| | -- ....rest of files and folders
|
|-- .git
|-- ... rest of files and folders
The lsp should think of the django_project
as the root of working directory but instead thinking project
as the working directory since the .git
lives there. Therefore, when I try to use the auto import feature, it imports as from django_project.my_app.models import ....
.
I tried to set autocmd FileType python let b:coc_root_patterns = ["Pipfile"]
on my nvim config file to override the working directory to be where the Pipfile
is, and it works for coc-explorer but coc-pyright still does not work properly.
Is there any way to set cwd correctly to remove the warnings?
Thank you for your help in advance, and happy holidays!
I've ported some features from vscode-python/coc-python to coc-pyright:
coc-python | coc-pyright | Will Support? |
---|---|---|
python.startREPL | - | No |
python.createTerminal | - | No |
python.execInTerminal | - | No |
python.buildWorkspaceSymbols | - | No |
python.upgradePythonLanguageServer | - | No |
python.viewOutput | - | No |
python.goToPythonObject | - | No |
python.setLinter | - | No |
python.enableLinting | - | No |
python.setInterpreter | - | No #99 |
python.runLinting | python.runLinting | √ |
python.sortImports | python.sortImports | √ |
- | pyright.restartserver | √ |
- | pyright.createtypestub | √ |
coc-python | coc-pyright | Will support? |
---|---|---|
python.autoComplete.* | - | No |
python.jedi* | - | No |
python.autoUpdateLanguageServer | - | No |
python.disableInstallationCheck | - | No |
python.trace.server | - | No |
python.globalModuleInstallation | - | No |
python.analysis.downloadChannel | - | No |
python.analysis.diagnosticEnabled | - | No |
python.analysis.diagnosticPublishDelay | - | No |
python.analysis.errors | - | No |
python.analysis.warnings | - | No |
python.analysis.information | - | No |
python.analysis.disabled | - | No |
python.analysis.symbolsHierarchyDepthLimit | - | No |
python.condaPath | - | No |
python.pipenvPath | - | No |
python.poetryPath | - | No |
python.venvFolders | - | No |
python.workspaceSymbols.* | - | No |
python.terminal.* | - | No |
python.venvPath | python.venvPath | √ |
python.pythonPath | python.pythonPath | √ |
python.formatting.* | python.formatting.* | √ |
- | python.formatting.blackdPath | √ |
- | python.formatting.blackdHTTPURL | √ |
python.sortImports.* | python.sortImports.* | √ |
python.linting.* | python.linting.* | √ |
- | python.linting.pytypeEnabled | √ |
- | python.linting.pytypePath | √ |
- | python.linting.pytypeArgs | √ |
python.analysis.typeshedPaths | python.analysis.typeshedPaths | √ |
python.analysis.openFilesOnly | python.analysis.diagnosticMode | √ |
python.analysis.logLevel | python.analysis.logLevel | √ |
- | python.analysis.extraPaths | √ |
- | python.analysis.typeshedPaths | √ |
- | python.analysis.autoImportCompletions | √ |
- | python.analysis.autoSearchPaths | √ |
- | python.analysis.stubPath | √ |
- | python.analysis.diagnosticSeverityOverrides | √ |
- | python.analysis.typeCheckingMode | √ |
- | python.analysis.useLibraryCodeForTypes | √ |
- | pyright.disableCompletion | √ |
- | pyright.disableLanguageServices | √ |
- | pyright.disableOrganizeImports | √ |
coc-pyright is faaaaaaaaaar better than coc-python speaking of the language server pyright. I really miss the python.setInterpreter
feature from coc-python. Without it, I have to currently set an absolute python path to the config "python.pythonPath".
It seems that even though black is installed into the relevant virtualenv, coc-pyright is not utilizing it. There doesn't seem to be an error, instead when the formatter runs nothing appears to happen. However if I run the formatter directly, i.e. in the activated virtualenv, then it works as expected.
I have the following function (which is simply from the "default" coc config)
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
I have noticed that doc comments which are multiple lines include extra new lines when displayed with this function.
Take this multi-line doc comment for example:
when using the function, I see:
As you can see, it is making newlines to make sure the doc stays within the bounds of the popup, but also including the new lines from the doc comment itself, resulting in weird breaks in the comment.
Apologies if this is not the plugin's fault but instead coc, vim, pyright, etc.
Thanks for the extension!
My :CocConfig
:
{
// Change all location jump, like jump to definition, in new tab.
// From https://github.com/neoclide/coc.nvim/issues/318#issuecomment-452488348
"coc.preferences.jumpCommand": "tab drop",
// coc-pyright
"python.linting.banditEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.pydocstyleEnabled": true,
"python.linting.pylintEnabled": true
}
:CocCommand workspace.showOutput
- coc-pyright-linting
opens an empty vertical split window. It should show active linter:xxx
logs.
I have all the linters installed in my system with pipenv, and I execute pipenv shell
before using neovim.
Sourcery is an AI tool that refactors code link. It adds items to :CocFix
, when it finds any ways to improve the code. When coc-pyright is installed, it somehow overwrites those fixes.
e.g.
When coc-pyright is not installed, :CocFix
changes dict()
to {}
. With coc-pyright installed, nvim prints [coc.nvim] No quickfix action available
.
class choises_printer:
def __init__(self):
self.choise = dict()
def set_choise(l: int, i: int):
self.choise[l] = i
Hi, @fannheyward @Maswor
I also tried the format feature ported from coc-python or vscode-python.
Relative PATH was also possible when setting python.formatting.blackPath
in "coc-python".
In "coc-pyright", you had to specify it in the absolute PATH.
If you set up "coc-pyright" with a relative PATH, it seems to show only the echo message, not the actual formatting.
{
// ...snip
"python.formatting.blackPath": "~/.local/bin/black",
// ...snip
}
DEMO
{
// ...snip
"python.formatting.blackPath": "/Users/yaegassy/.local/bin/black",
// ...snip
}
DEMO
Originally posted by @yaegassy in #81 (comment)
vim version: NVIM v0.5.0-610-g326b87feb
node version: v14.5.0
coc.nvim version: 0.0.78-0ff42027ff
coc.nvim directory: /home/kino/.cache/dein/repos/github.com/neoclide/coc.nvim_release
term: xterm-256color
platform: linux
[Info - 8:45:28 AM] Pyright language server 1.1.60 starting
[Info - 8:45:28 AM] Server root directory: /home/kino/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/
[Error - 8:45:28 AM] stubPath typings is not a valid directory.
Pyright flags unused function parameters with a hint.
That is often helpful, but when you're trying to satisfy some library's API, you may want to include placeholders for parameters even if a function or method doesn't actually use them. An unused argument warning can be silenced by naming a parameter _
, but that only works for one parameter. Names can be dundered (like __name__
), but that feels like a hack, and doesn't work for keyword parameters. You could also use *arg
and **kwargs
, but is a bit less clear that having placeholders.
According to this, the Pyright language server tags unused parameter hints in some way, and the LSP client can tell Pyright that it doesn't support this tag to prevent Pyright from sending these hints. Possibly coc-pyright could provide an option to disable unused argument hints.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.