-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
How do you match a glob pattern at the top-level? #490
Comments
I'm afraid I'm not very familiar with this area, but my first thought is that, as you suggest, this is more of a client issue. Which editor are you using? |
I've tested this on 2 clients:
The dummy server implementation I'm using: from pygls.server import LanguageServer
from lsprotocol import types
server = LanguageServer("example-server", "v0.1")
@server.feature(types.INITIALIZED)
def init(ls, params):
ls.register_capability(types.RegistrationParams(
registrations = [
types.Registration(
id = "matcher-test",
method = types.WORKSPACE_DID_CHANGE_WATCHED_FILES,
register_options = types.DidChangeWatchedFilesRegistrationOptions(watchers = [
types.FileSystemWatcher(glob_pattern = "*.ts", kind = types.WatchKind.Create | types.WatchKind.Change | types.WatchKind.Delete),
types.FileSystemWatcher(glob_pattern = "./*.js", kind = types.WatchKind.Create | types.WatchKind.Change | types.WatchKind.Delete),
types.FileSystemWatcher(glob_pattern = "**.ini", kind = types.WatchKind.Create | types.WatchKind.Change | types.WatchKind.Delete),
types.FileSystemWatcher(glob_pattern = "**/*.cfg", kind = types.WatchKind.Create | types.WatchKind.Change | types.WatchKind.Delete),
])
)
]
))
if __name__ == "__main__":
server.start_io() In this example, only Given that it doesn't work in 2 different clients, I'm inclined to think that it's something on the server side. |
The LSP specifications for Therefore, providing a relative glob pattern for the top level, such as
then passing an absolute glob pattern, with some path normalisation handled somewhere between the server and client, will work. The pygls VSCode extension should be able to pick up
|
So, it is possible to achieve non-recursive, top-level file change notifications by using an absolute path (as opposed to a relative path)? And that's why you closed the issue? Let me just summarise my understanding of using the
|
I agree with most of your summary - except whether pygls should provide a default for patterns like I closed this issue because I realised that you were right in it being a client issue, and I'm not sure if there's anything actionable in pygls. Absolute paths like
|
Sorry for the late reply. This thread is a good insight and summary of the issue, so I'm glad you brought it up. So let's assume that there's nothing that Pygls can do to help at the moment. But we can revisit if needs be. |
I'm not sure if I'm configuring pygls wrong, or if it's the client's issue, or if this is a bug.
I followed #376 to dynamically register the feature
workspace/didChangeWatchedFiles
, with the watched file pattern**/*.py
, which worked fine; 0-or-more nested directories when Python files are added/deleted/changed trigger the notificationworkspace/didChangeWatchedFiles
.Now, I'm trying to restrict the pattern to files at the top-level. Following the LSP specification, I assume this would look like (following a typescript file extension)
but this isn't working (
workspace/didChangeWatchedFiles
is not being triggered when adding/deleting/changing.ts
files).I've tried the following:
*.ts
./*.ts
lsprotocol.types.RelativePattern
to construct a pattern, using the current working directory's absolute path to create the argument to thebase_uri
parameterRelativePattern(base_uri=)
If any of this makes any difference:
PYTHONPATH
environment variable;__main__.py
script located as<project workspace root>/language_server/__main__.py
;cwd
is the project workspace root.The text was updated successfully, but these errors were encountered: