Skip to content

Commit

Permalink
Move codeLens capability to new file
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Guggenmos <[email protected]>
  • Loading branch information
slrtbtfs committed Mar 25, 2022
1 parent 79a6ff7 commit 463023c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
28 changes: 28 additions & 0 deletions langserver/codeLens.go
Original file line number Diff line number Diff line change
@@ -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
}
9 changes: 0 additions & 9 deletions langserver/notImplemented.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 463023c

Please sign in to comment.