UNPKG

fish-lsp

Version:

LSP implementation for fish/fish-shell

24 lines (23 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getReferenceCountCodeLenses = getReferenceCountCodeLenses; const references_1 = require("./references"); const translation_1 = require("./utils/translation"); function getReferenceCountCodeLenses(analyzer, document) { const codeLenses = []; const globalSymbols = analyzer.getFlatDocumentSymbols(document.uri) .filter(symbol => symbol.fishKind === 'FUNCTION'); for (const symbol of globalSymbols) { const references = (0, references_1.getReferences)(document, symbol.selectionRange.start) || []; const referencesCount = references.length; codeLenses.push({ range: symbol.range, command: { title: `${referencesCount} references`, command: 'fish-lsp.showReferences', arguments: [(0, translation_1.uriToPath)(document.uri), symbol.selectionRange.start, references], }, }); } return codeLenses; }