Rename doesn't work across files when pyproject.toml is present
See original GitHub issueWhat’s the output of :CocCommand pyright.version
coc-pyright 1.1.271 with Pyright 1.1.271
(Installed via :CocInstall https://github.com/fannheyward/coc-pyright
)
What’s the output of :CocCommand workspace.showOutput Pyright
Workspace: /home/kaspar/example
Using python from /home/kaspar/.pyenv/shims/python
[Trace - 16:47:23] Sending request 'initialize - (0)'.
Params: {
"processId": 33713,
"rootPath": "/home/kaspar/example",
"rootUri": "file:///home/kaspar/example",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "undo",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": false
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true,
"relativePatternSupport": true
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
},
"semanticTokens": {
"refreshSupport": true
},
"inlayHint": {
"refreshSupport": true
},
"inlineValue": {
"refreshSupport": true
},
"diagnostics": {
"refreshSupport": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"location.range"
]
}
},
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": true,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"insertReplaceSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"labelDetailsSupport": true,
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
},
"insertTextMode": 2,
"completionList": {
"itemDefaults": [
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode"
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"contextSupport": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"activeParameterSupport": false,
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"references": {
"dynamicRegistration": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"honorsChangeAnnotations": false,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
}
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"honorsChangeAnnotations": true,
"prepareSupportDefaultBehavior": 1
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true,
"foldingRangeKind": {
"valueSet": [
"comment",
"imports",
"region"
]
},
"foldingRange": {
"collapsedText": false
}
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"linkedEditingRange": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"decorator",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false,
"serverCancelSupport": true,
"augmentsSyntaxTokens": true
},
"inlayHint": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"tooltip",
"textEdits",
"label.tooltip",
"label.location",
"label.command"
]
}
},
"inlineValue": {
"dynamicRegistration": true
},
"diagnostic": {
"dynamicRegistration": true,
"relatedDocumentSupport": true
},
"typeHierarchy": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "4.0.10"
},
"positionEncodings": [
"utf-16"
],
"staleRequestSupport": {
"cancel": true,
"retryOnContentModified": [
"textDocument/inlayHint",
"textDocument/semanticTokens/full",
"textDocument/semanticTokens/range",
"textDocument/semanticTokens/full/delta"
]
}
}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/kaspar/example",
"name": "example"
}
],
"locale": "en_GB",
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.82"
},
"workDoneToken": "5ffefec9-8dbf-4db7-8f4b-2a15ba0ce15c"
}
[Trace - 16:47:23] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Pyright language server 1.1.271 starting"
}
[Info - 16:47:23] Pyright language server 1.1.271 starting
[Trace - 16:47:23] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Server root directory: /home/kaspar/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/"
}
[Info - 16:47:23] Server root directory: /home/kaspar/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/
[Trace - 16:47:23] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Starting service instance \"example\""
}
....
To reproduce:
Set up a clean nvim and coc config
mv ~/.config/nvim ~/.config/nvim.backup
mv ~/.config/coc ~/.config/coc.backup
mv ~/.local/share/nvim ~/.local/share/nvim.backup
git clone https://github.com/neoclide/coc.nvim ~/.local/share/nvim/site/pack/bundle/start/coc.nvim
cd ~/.local/share/nvim/site/pack/bundle/start/coc.nvim && yarn && cd -
Open nvim and run :CocInstall https://github.com/fannheyward/coc-pyright
Make the example project:
mkdir -p example/example
cat << EOF > example/example/x.py
test_var = "hello"
EOF
cat << EOF > example/example/y.py
import x
print(x.test_var)
EOF
Renaming works when running :execute "normal \<Plug>(coc-rename)"
on test_var
. But when you add pyproject.toml
:
touch example/pyproject.toml
It stops working across files.
Adding information to pyproject.toml, using relative imports (with __init__.py
and from . import x
) doesn’t seem to solve this. I encountered this working on an actual open source project which has a pyproject.toml, you should be able to reproduce with that as well.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
coc-pyright v1.1.272 has been released with latest Pyright.
Thanks! Can confirm: I installed an unreleased Pyright and set
pyright.server
with:CocConfig
and it works.