Skip to content

Commit 463023c

Browse files
committed
Move codeLens capability to new file
Signed-off-by: Tobias Guggenmos <[email protected]>
1 parent 79a6ff7 commit 463023c

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

langserver/codeLens.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2020 The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License. // You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
13+
package langserver
14+
15+
import (
16+
"context"
17+
18+
"github.com/prometheus-community/promql-langserver/internal/vendored/go-tools/lsp/protocol"
19+
)
20+
21+
// CodeLens is required by the protocol.Server interface.
22+
func (s *server) CodeLens(_ context.Context, _ *protocol.CodeLensParams) ([]protocol.CodeLens, error) {
23+
// As of version 0.4.0 of gopls it is not possible to instruct the language
24+
// client to stop asking for Code Lenses and Document Links. To prevent
25+
// VS Code from showing error messages, this feature is implemented by
26+
// returning empty values.
27+
return nil, nil
28+
}

langserver/notImplemented.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,6 @@ func (s *server) Symbol(_ context.Context, _ *protocol.WorkspaceSymbolParams) ([
141141
return nil, notImplemented("Symbol")
142142
}
143143

144-
// CodeLens is required by the protocol.Server interface.
145-
func (s *server) CodeLens(_ context.Context, _ *protocol.CodeLensParams) ([]protocol.CodeLens, error) {
146-
// As of version 0.4.0 of gopls it is not possible to instruct the language
147-
// client to stop asking for Code Lenses and Document Links. To prevent
148-
// VS Code from showing error messages, this feature is implemented by
149-
// returning empty values.
150-
return nil, nil
151-
}
152-
153144
// ResolveCodeLens is required by the protocol.Server interface.
154145
func (s *server) ResolveCodeLens(_ context.Context, _ *protocol.CodeLens) (*protocol.CodeLens, error) {
155146
return nil, notImplemented("ResolveCodeLens")

0 commit comments

Comments
 (0)