MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / handleSemanticTokensFull

Method handleSemanticTokensFull

pkg/lsp/handler.go:1704–1718  ·  view source on GitHub ↗

handleSemanticTokensFull handles textDocument/semanticTokens/full requests. It tokenizes the document and returns LSP-encoded semantic token data.

(params SemanticTokensParams)

Source from the content-addressed store, hash-verified

1702// handleSemanticTokensFull handles textDocument/semanticTokens/full requests.
1703// It tokenizes the document and returns LSP-encoded semantic token data.
1704func (h *Handler) handleSemanticTokensFull(params SemanticTokensParams) (*SemanticTokens, error) {
1705 doc, ok := h.server.Documents().Get(params.TextDocument.URI)
1706 if !ok {
1707 return &SemanticTokens{Data: []uint32{}}, nil
1708 }
1709
1710 tkz := tokenizer.GetTokenizer()
1711 defer tokenizer.PutTokenizer(tkz)
1712 tokens, err := tkz.Tokenize([]byte(doc.Content))
1713 if err != nil {
1714 return &SemanticTokens{Data: []uint32{}}, nil
1715 }
1716
1717 return &SemanticTokens{Data: encodeSemanticTokens(tokens)}, nil
1718}
1719
1720// encodeSemanticTokens converts token positions to LSP semantic token encoding.
1721// Each token is encoded as 5 uint32 values:

Callers 1

HandleRequestMethod · 0.95

Calls 6

GetTokenizerFunction · 0.92
PutTokenizerFunction · 0.92
encodeSemanticTokensFunction · 0.85
DocumentsMethod · 0.80
TokenizeMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected