From 86c44e939651d25bc97770a7b170964da8fc85e2 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 20 Mar 2026 13:46:02 -0500 Subject: [PATCH] Add workspace/didChangeWatchedFiles notification handler. Created/changed files are queued for re-parse via the parser channel. Deleted files are removed from the files and symbols hashes. --- lib/Perl/LanguageServer/Methods/workspace.pm | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/Perl/LanguageServer/Methods/workspace.pm b/lib/Perl/LanguageServer/Methods/workspace.pm index 1ac8e4a..b548462 100644 --- a/lib/Perl/LanguageServer/Methods/workspace.pm +++ b/lib/Perl/LanguageServer/Methods/workspace.pm @@ -164,6 +164,34 @@ sub _rpcnot_didChangeWorkspaceFolders # --------------------------------------------------------------------------- +sub _rpcnot_didChangeWatchedFiles + { + my ($self, $workspace, $req) = @_ ; + + my $changes = $req -> params -> {changes} ; + return if (!$changes) ; + + foreach my $change (@$changes) + { + my $uri = $change -> {uri} ; + my $type = $change -> {type} ; + + if ($type == 3) + { + delete $workspace -> files -> {$uri} ; + delete $workspace -> symbols -> {$uri} ; + } + else + { + $workspace -> parser_channel -> put (['save', $uri]) ; + } + } + + return ; + } + +# --------------------------------------------------------------------------- + sub _rpcreq_symbol { my ($self, $workspace, $req) = @_ ;