coc-pydocstring
doq (python docstring generator) extension for coc.nvim
Install
CocInstall:
:CocInstall coc-pydocstring
vim-plug:
Plug 'yaegassy/coc-pydocstring', {'do': 'yarn install --frozen-lockfile'}
Feature
Quickly generate docstrings for python.
- Code Action
- Command
- Built-in installer
Configuration options
pydocstring.enable: Enable coc-pydocstring extension, default:truepydocstring.doqPath: The path to the doq tool (Absolute path), default:""pydocstring.builtin.pythonPath: Python 3.x path (Absolute path) to be used for built-in install, default:""pydocstring.enableInstallPrompt: Prompt the user before install, default:truepydocstring.formatter: Docstring formatter (--formatter), valid options["sphinx", "google", "numpy"], default:"sphinx"pydocstring.templatePath: Path to template directory (--template_path), default:""pydocstring.ignoreException: Ignore exception statements (--ignore_exception), default:falsepydocstring.ignoreYield: Ignore yield statements (--ignore_yield), default:falsepydocstring.ignoreInit: Ignore generate docstring to init method (--ignore_init). This option only available at:CocCommand pydocstring.runFile, default:falsepydocstring.enableFileAction: Enable file-level code action, default:false
Code Actions
Example key mapping (Code Action related):
nmap <silent> ga <Plug>(coc-codeaction-line)
xmap <silent> ga <Plug>(coc-codeaction-selected)
nmap <silent> gA <Plug>(coc-codeaction)
Usage:
In a "line" or "selection" containing def, async def, or class, enter the mapped key (e.g. ga) and display a list of code actions that can be performed.
Add docstring for "Line or Selected" by pydocstringAdd docstring for "File" by pydocstring- File-level code actions are disabled (
false) by default. - If you want to use it, set
pydocstring.enableFileActiontotruein "coc-settings.json".
- File-level code actions are disabled (
Commands
pydocstring.runFile: Run doq for filepydocstring.install: Install doq- It will be installed in this path:
- Mac/Linux:
~/.config/coc/extensions/coc-pydocstring-data/doq/venv/bin/doq - Windows:
~/AppData/Local/coc/extensions/coc-pydocstring-data/doq/venv/Scripts/doq.exe
- Mac/Linux:
- It will be installed in this path:
Similar plugins
- heavenshell/vim-pydocstring
- This is a vim plugin by the author of doq.
Thanks
License
MIT
This extension is built with create-coc-extension
