[tintd] Handle lsp::WorkspaceDidChangeWatchedFilesNotification
We don't care about this notification, but without a handler, we currently error and shutdown.
Bug: tint:2127
Change-Id: I0fc7439b3f040c7b3ac04fa7b3d2ec19a3f9f206
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/181120
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/wgsl/ls/BUILD.bazel b/src/tint/lang/wgsl/ls/BUILD.bazel
index 25ddd43..8a94377 100644
--- a/src/tint/lang/wgsl/ls/BUILD.bazel
+++ b/src/tint/lang/wgsl/ls/BUILD.bazel
@@ -41,6 +41,7 @@
srcs = [
"cancel_request.cc",
"change_configuration.cc",
+ "change_watched_files.cc",
"definition.cc",
"diagnostics.cc",
"document.cc",
diff --git a/src/tint/lang/wgsl/ls/BUILD.cmake b/src/tint/lang/wgsl/ls/BUILD.cmake
index 611c64d..f5b6632 100644
--- a/src/tint/lang/wgsl/ls/BUILD.cmake
+++ b/src/tint/lang/wgsl/ls/BUILD.cmake
@@ -43,6 +43,7 @@
tint_add_target(tint_lang_wgsl_ls lib
lang/wgsl/ls/cancel_request.cc
lang/wgsl/ls/change_configuration.cc
+ lang/wgsl/ls/change_watched_files.cc
lang/wgsl/ls/definition.cc
lang/wgsl/ls/diagnostics.cc
lang/wgsl/ls/document.cc
diff --git a/src/tint/lang/wgsl/ls/BUILD.gn b/src/tint/lang/wgsl/ls/BUILD.gn
index 6dde581..d3d285e 100644
--- a/src/tint/lang/wgsl/ls/BUILD.gn
+++ b/src/tint/lang/wgsl/ls/BUILD.gn
@@ -46,6 +46,7 @@
sources = [
"cancel_request.cc",
"change_configuration.cc",
+ "change_watched_files.cc",
"definition.cc",
"diagnostics.cc",
"document.cc",
diff --git a/src/tint/lang/wgsl/ls/change_watched_files.cc b/src/tint/lang/wgsl/ls/change_watched_files.cc
new file mode 100644
index 0000000..e004f8e
--- /dev/null
+++ b/src/tint/lang/wgsl/ls/change_watched_files.cc
@@ -0,0 +1,40 @@
+// Copyright 2024 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "langsvr/lsp/lsp.h"
+#include "src/tint/lang/wgsl/ls/server.h"
+
+namespace lsp = langsvr::lsp;
+
+namespace tint::wgsl::ls {
+
+langsvr::Result<langsvr::SuccessType> Server::Handle(
+ const lsp::WorkspaceDidChangeWatchedFilesNotification&) {
+ return langsvr::Success;
+}
+
+} // namespace tint::wgsl::ls
diff --git a/src/tint/lang/wgsl/ls/server.cc b/src/tint/lang/wgsl/ls/server.cc
index 6b526de..65e6d62 100644
--- a/src/tint/lang/wgsl/ls/server.cc
+++ b/src/tint/lang/wgsl/ls/server.cc
@@ -27,6 +27,7 @@
#include "src/tint/lang/wgsl/ls/server.h"
+#include "langsvr/lsp/lsp.h"
#include "langsvr/session.h"
#include "src/tint/lang/wgsl/ls/sem_token.h"
@@ -102,6 +103,8 @@
session.Register(
[&](const lsp::TextDocumentSemanticTokensFullRequest& r) { return Handle(r); });
session.Register([&](const lsp::TextDocumentSignatureHelpRequest& r) { return Handle(r); });
+ session.Register(
+ [&](const lsp::WorkspaceDidChangeWatchedFilesNotification& n) { return Handle(n); });
}
Server::~Server() = default;
diff --git a/src/tint/lang/wgsl/ls/server.h b/src/tint/lang/wgsl/ls/server.h
index e0df2f3..a9c55a1 100644
--- a/src/tint/lang/wgsl/ls/server.h
+++ b/src/tint/lang/wgsl/ls/server.h
@@ -127,6 +127,10 @@
langsvr::Result<langsvr::SuccessType> //
Handle(const langsvr::lsp::WorkspaceDidChangeConfigurationNotification&);
+ /// Handler for langsvr::lsp::WorkspaceDidChangeWatchedFilesNotification
+ langsvr::Result<langsvr::SuccessType> //
+ Handle(const langsvr::lsp::WorkspaceDidChangeWatchedFilesNotification&);
+
/// Publishes the tint::Program diagnostics to the server via a
/// TextDocumentPublishDiagnosticsNotification.
langsvr::Result<langsvr::SuccessType> //