| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
**Problem**: When working in a python monorepo with a base `pyproject.toml`, and `pyrightconfig.json` files that extend this base configuration in subdirectories, `pyright` will not recognize these `pyrightconfig.json` and identify these subdirectories (project1 | project2) as root directories because `pyproject.toml` takes precedence.
```sh
# Example structure
monorepo
├── project1
│ ├── pyrightconfig.json
│ └── src
│ └── main.py
├── project2
│ ├── pyrightconfig.json
│ └── src
│ └── main.py
└── pyproject.toml
```
From the pyright docs [1]
> A “pyrightconfig.json” file always takes precedent over “pyproject.toml” if both are present
**Solution**: Update the order of the `root_markers` to prefer `pyrightconfig.json` so priority is in line with pyrights documentation.
**Testing**: When creating a simple monorepo structure with the following command
```sh
mkdir monorepo && touch monorepo/pyproject.toml && mkdir monorepo/project1 && touch monorepo/project1/pyrightconfig.json && mkdir monorepo/project1/src && touch monorepo/project1/src/main.py && cp -r monorepo/project1 monorepo/project2
```
You should be able to open one of the subdirectories `nvim monorepo/project1/src/main.py` and check your LSP root dir with `:LspInfo`, and it should be attached to the subdirectory.
1. https://github.com/microsoft/pyright/blob/main/docs/configuration.md#pyright-configuration
|
| |
|
|
|
| |
`vim.api.nvim_buf_create_user_command` callback is called with a table
argument that contains a parsed command. Need to use `args` or `fargs`
key to get command arguments.
|
| |
|
|
|
|
|
|
|
|
| |
Problem:
The `pyright.organizeimports` is private, so client:exec_cmd()
fails because it refuses to run commands that are not advertised
as capabilities.
Solution:
Call client.request() to side-step the check in client:exec_cmd().
YOLO
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Problem:
If a server is attached to a non-current buffer by
`vim.lsp.buf_attach_client`, then the Language Server-related
commands may be created in the current (wrong) buffer.
Solution:
Always use the `bufnr` arg provided to `on_attach`.
|
| |
|
|
| |
Use `client:exec_cmd()` instead of calling
`request("workspace/executeCommand")` directly.
|
| | |
|
| |
|
|
|
| |
- brief should live at the top of each file
- fix indentation for some docs
|
| |
|
|
|
|
|
|
| |
Problem:
Since configs now live in `lsp/`, the docgen needs to be updated.
Solution:
Read the configs from `lsp/`. Parse the `@brief` docstring to get the
docs.
|
|
|
Problem:
Nvim 0.11 has vim.lsp.config, which mostly replaces the legacy
nvim-lspconfig "framework".
Solution:
Migrate all configs to `lsp/*` variants. The old configs in
`lua/lspconfig/` are "frozen".
The new configs include these changes:
- `commands` field became raw calls to
`vim.api.nvim_buf_create_user_command` inside `on_attach`.
- `root_dir` became:
- `root_markers` whenever the file list was simple didn't need to mach `*`
- if the logic was complicated, or needed to match something like
'\*.c', it was defined as a vim.lsp.Config `root_dir` callback.
- `on_config_change` became `before_init`. I don't actually know if this
is the correct approach, but looking around the documentation of
`nvim-lspconfig` a saw that it was defined as the function that gets
called as soon as the config have `root_dir`, and so I thought
`before_init` might be the closest alternative.
- `docs.description` became a luadoc `@brief` docstring.
- `single_file_support = false`?
Co-authored-by: Aliou Diallo <aliou@users.noreply.github.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
|