Skip to content
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

Add per-file LSP activation rules allowpaths, blockpaths #1380

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pavoljuhas
Copy link

@pavoljuhas pavoljuhas commented Oct 18, 2022

Add optional items allowpaths, blockpaths for the server_info dictionary.
allowpaths and blockpaths are lists of regular expressions matched
on the full path of the active file. LSP is enabled if the current buffer
matches any pattern in the allowpaths or when allowpaths is not
present in the server_info dictionary. LSP is disabled if any of the
blockpaths patterns matches the current file. The blockpaths rule
has priority when both allowpaths and blockpaths match.

The allowpaths and blockpaths are consulted only when LSP is
enabled by the allowlist, blocklist rules for buffer filetypes.

Fixes #1041

`allowpaths` and `blockpaths` are lists of regular expressions matched
with the full path of the active file.  LSP is enabled if it matches
any pattern in the `allowpaths` list or when `allowpaths` is not present
in the server_info dictionary.  LSP is disabled if any of the `blockpaths`
patterns matches the current buffer.  The `blockpaths` rule has priority
when both `allowpaths` and `blockpaths` match.

The `allowpaths` and `blockpaths` are evaluated only if the LSP is
enabled by the `allowlist`, `blocklist` rules for buffer filetypes.
A single `*` pattern in `allowpaths` or `blockpaths` matches everything.
All other patterns are evaluated and matched as regular expressions.
@prabirshrestha
Copy link
Owner

Can we use a function instead of a list, such that any custom code can be allowed?

@pavoljuhas
Copy link
Author

Sure, I'll get to it in next few days.

@prabirshrestha
Copy link
Owner

Can you also fix the lint issues. Do sync with the latest master branch too.

@lilydjwg
Copy link

I'm seeking for lsp that can be manually enabled on a per project basis, because I want to avoid resource usage for files I read and copy from.

@pusewicz
Copy link
Contributor

@pavoljuhas Are you still interested in merging this PR? Would you mind addressing the feedback? Thanks!

@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can I enable/disable per-path whether to use a server?
4 participants