Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yaegassy/coc-pydocstring
doq (python docstring generator) extension for coc.nvim
https://github.com/yaegassy/coc-pydocstring
coc coc-extensions coc-nvim docstring neovim python vim
Last synced: 19 days ago
JSON representation
doq (python docstring generator) extension for coc.nvim
- Host: GitHub
- URL: https://github.com/yaegassy/coc-pydocstring
- Owner: yaegassy
- License: mit
- Created: 2021-04-06T10:52:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-08T01:50:14.000Z (over 1 year ago)
- Last Synced: 2024-10-14T18:41:01.104Z (27 days ago)
- Topics: coc, coc-extensions, coc-nvim, docstring, neovim, python, vim
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/coc-pydocstring
- Size: 218 KB
- Stars: 30
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coc-pydocstring
[doq](https://pypi.org/project/doq/) (python docstring generator) extension for [coc.nvim](https://github.com/neoclide/coc.nvim)
## Install
**CocInstall**:
```vim
:CocInstall coc-pydocstring
```**vim-plug**:
```vim
Plug 'yaegassy/coc-pydocstring', {'do': 'yarn install --frozen-lockfile'}
```## Feature
Quickly generate docstrings for python.
- Code Action
- Command
- Built-in installer## Detect: "doq" command
1. `pydocstring.doqPath` setting
1. PATH environment (e.g. system global PATH or venv, etc ...)
1. builtin: extension-only "venv" (Installation commands are also provided)## Built-in install
coc-pydocstring allows you to create an extension-only "venv" and install "doq".
The first time you use coc-pydocstring, if "doq" command is not detected, you will be prompted to do a built-in installation.
You can also run the installation command manually.
```vim
:CocCommand pydocstring.install
```## Configuration options
- `pydocstring.enable`: Enable coc-pydocstring extension, default: `true`
- `pydocstring.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: `true`
- `pydocstring.formatter`: Docstring formatter (--formatter), valid options `["sphinx", "google", "numpy"]`, default: `"sphinx"`
- `pydocstring.templatePath`: Path to template directory (--template_path), Settings starting with `/` are recognized as `absolute path`, while others are treated as `relative path` from the `workspace root`. Additionally, both `~` and `$HOME` are also available and will be expanded as `absolute path`, default: `""`
- `pydocstring.ignoreException`: Ignore exception statements (--ignore_exception), default: `false`
- `pydocstring.ignoreYield`: Ignore yield statements (--ignore_yield), default: `false`
- `pydocstring.ignoreInit`: Ignore generate docstring to `__init__` method (--ignore_init). This option only available at `:CocCommand pydocstring.runFile`, default: `false`
- `pydocstring.enableFileAction`: Enable file-level code action, default: `false`## Code Actions
**Example key mapping (Code Action related)**:
```vim
nmap ga (coc-codeaction-line)
xmap ga (coc-codeaction-selected)
nmap gA (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 pydocstring`
- `Add docstring for "File" by pydocstring`
- File-level code actions are disabled (`false`) by default.
- If you want to use it, set `pydocstring.enableFileAction` to `true` in "coc-settings.json".## Commands
- `pydocstring.runFile`: Run doq for file
- `pydocstring.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`
- `pydocstring.showOutput`: Show pydocstring output channel## Similar plugins
- [heavenshell/vim-pydocstring](https://github.com/heavenshell/vim-pydocstring)
- This is a vim plugin by the author of doq.## Thanks
- [heavenshell/py-doq](https://github.com/heavenshell/py-doq) | [doq](https://pypi.org/project/doq/)
## License
MIT
---
> This extension is built with [create-coc-extension](https://github.com/fannheyward/create-coc-extension)