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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: document.getText is not a function #15
Comments
Thanks for the issue report. 🙇 I am unable to reproduce this issue in my environment. Can you provide the Python code to reproduce and the steps to reproduce it? |
Does it work correctly when run without telescope? |
I cannot reproduce this in my environment. DEMO (mp4): coc-pydocstring-codeaction-check.mp4 |
I have fix the problem by changing two lines in function "activate" context.subscriptions.push(import_coc4.commands.registerCommand("pydocstring.runAction", async (document, range) => {
const doc = import_coc4.workspace.getDocument(document.uri);
let edits;
const code = await doFormat(context, outputChannel, doc.textDocument, range); // document => doc.textDocument
if (!range) {
range = fullDocumentRange(document);
edits = [import_coc4.TextEdit.replace(range, code)];
if (edits) {
return await doc.applyEdits(edits);
}
}
if (doc.textDocument.getText() === code) { // document => doc.textDocument
return;
}
edits = [import_coc4.TextEdit.replace(range, code)];
if (edits) {
return await doc.applyEdits(edits);
}
}, null, true)); |
Thanks for looking into the fixes. However, I think it is probably occurring because of the particular way you are executing CodeAction. Would the same error occur if you execute a code action in your environment with the following mappings? Example key mapping: nmap <silent> ga <Plug>(coc-codeaction-line)
xmap <silent> ga <Plug>(coc-codeaction-selected) |
OK ! I already tried by this way but I had the same issue. But maybe I could be interesting to make coc-pydocstring compatible with theses plugins. |
Hi,
thank you for the plugin, it seems very cool.
I have an error when I run (coc-codeaction-line) then
Add docstring for "Line or Selected" by pydocstring
:note that
CocCommand pydocstring.runFile
works well.Config:
nvim : v0.8.0-dev+448-g7b2b44bce
coc-pydocstring: 0.7.3
coc is up to date
doc is installed by
CocCommand pydocstring.install
The text was updated successfully, but these errors were encountered: