protected async Task HandleDocumentSymbolRequest( TextDocumentIdentifier textDocumentIdentifier, RequestContext<SymbolInformation[]> requestContext) { ScriptFile scriptFile = editorSession.Workspace.GetFile( textDocumentIdentifier.Uri); FindOccurrencesResult foundSymbols = editorSession.LanguageService.FindSymbolsInFile( scriptFile); SymbolInformation[] symbols = null; string containerName = Path.GetFileNameWithoutExtension(scriptFile.FilePath); if (foundSymbols != null) { symbols = foundSymbols .FoundOccurrences .Select(r => { return new SymbolInformation { ContainerName = containerName, Kind = GetSymbolKind(r.SymbolType), Location = new Location { Uri = new Uri(r.FilePath).AbsolutePath, Range = GetRangeFromScriptRegion(r.ScriptRegion) }, Name = GetDecoratedSymbolName(r) }; }) .ToArray(); } else { symbols = new SymbolInformation[0]; } await requestContext.SendResult(symbols); }
protected Task HandleDidCloseTextDocumentNotification( TextDocumentIdentifier closeParams, EventContext eventContext) { // Find and close the file in the current session var fileToClose = editorSession.Workspace.GetFile(closeParams.Uri); if (fileToClose != null) { editorSession.Workspace.CloseFile(fileToClose); } Logger.Write(LogLevel.Verbose, "Finished closing document."); return Task.FromResult(true); }