public Task <Container <SymbolInformation> > Handle(WorkspaceSymbolParams request, CancellationToken cancellationToken) { var symbols = new List <SymbolInformation>(); foreach (ScriptFile scriptFile in _workspaceService.GetOpenedFiles()) { List <SymbolReference> foundSymbols = _symbolsService.FindSymbolsInFile( scriptFile); // TODO: Need to compute a relative path that is based on common path for all workspace files string containerName = Path.GetFileNameWithoutExtension(scriptFile.FilePath); foreach (SymbolReference foundOccurrence in foundSymbols) { if (!IsQueryMatch(request.Query, foundOccurrence.SymbolName)) { continue; } var location = new Location { Uri = PathUtils.ToUri(foundOccurrence.FilePath), Range = GetRangeFromScriptRegion(foundOccurrence.ScriptRegion) }; symbols.Add(new SymbolInformation { ContainerName = containerName, Kind = foundOccurrence.SymbolType == SymbolType.Variable ? SymbolKind.Variable : SymbolKind.Function, Location = location, Name = GetDecoratedSymbolName(foundOccurrence) }); } } _logger.LogWarning("Logging in a handler works now."); return(Task.FromResult(new Container <SymbolInformation>(symbols))); }
private List <SymbolReference> FindSymbolsInFile(ScriptRegion scriptRegion) => symbolsService.FindSymbolsInFile(GetScriptFile(scriptRegion));