From 463023c37ee320228d2c3f6fcddfd7e709ab048e Mon Sep 17 00:00:00 2001 From: Tobias Guggenmos Date: Wed, 17 Jun 2020 14:57:04 +0200 Subject: [PATCH] Move codeLens capability to new file Signed-off-by: Tobias Guggenmos --- langserver/codeLens.go | 28 ++++++++++++++++++++++++++++ langserver/notImplemented.go | 9 --------- 2 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 langserver/codeLens.go diff --git a/langserver/codeLens.go b/langserver/codeLens.go new file mode 100644 index 00000000..10dc19ef --- /dev/null +++ b/langserver/codeLens.go @@ -0,0 +1,28 @@ +// Copyright 2020 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. // You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package langserver + +import ( + "context" + + "github.com/prometheus-community/promql-langserver/internal/vendored/go-tools/lsp/protocol" +) + +// CodeLens is required by the protocol.Server interface. +func (s *server) CodeLens(_ context.Context, _ *protocol.CodeLensParams) ([]protocol.CodeLens, error) { + // As of version 0.4.0 of gopls it is not possible to instruct the language + // client to stop asking for Code Lenses and Document Links. To prevent + // VS Code from showing error messages, this feature is implemented by + // returning empty values. + return nil, nil +} diff --git a/langserver/notImplemented.go b/langserver/notImplemented.go index b7d19bd4..6103dbbe 100644 --- a/langserver/notImplemented.go +++ b/langserver/notImplemented.go @@ -141,15 +141,6 @@ func (s *server) Symbol(_ context.Context, _ *protocol.WorkspaceSymbolParams) ([ return nil, notImplemented("Symbol") } -// CodeLens is required by the protocol.Server interface. -func (s *server) CodeLens(_ context.Context, _ *protocol.CodeLensParams) ([]protocol.CodeLens, error) { - // As of version 0.4.0 of gopls it is not possible to instruct the language - // client to stop asking for Code Lenses and Document Links. To prevent - // VS Code from showing error messages, this feature is implemented by - // returning empty values. - return nil, nil -} - // ResolveCodeLens is required by the protocol.Server interface. func (s *server) ResolveCodeLens(_ context.Context, _ *protocol.CodeLens) (*protocol.CodeLens, error) { return nil, notImplemented("ResolveCodeLens")