github.com/jd-ly/tools@v0.5.7/internal/lsp/workspace_symbol.go (about)

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package lsp
     6  
     7  import (
     8  	"context"
     9  
    10  	"github.com/jd-ly/tools/internal/event"
    11  	"github.com/jd-ly/tools/internal/lsp/protocol"
    12  	"github.com/jd-ly/tools/internal/lsp/source"
    13  )
    14  
    15  func (s *Server) symbol(ctx context.Context, params *protocol.WorkspaceSymbolParams) ([]protocol.SymbolInformation, error) {
    16  	ctx, done := event.Start(ctx, "lsp.Server.symbol")
    17  	defer done()
    18  
    19  	views := s.session.Views()
    20  	matcher := s.session.Options().SymbolMatcher
    21  	style := s.session.Options().SymbolStyle
    22  	return source.WorkspaceSymbols(ctx, matcher, style, views, params.Query)
    23  }