protected ALSyntaxTreeSymbol ProcessSyntaxTreeNode(dynamic syntaxTree, dynamic node) { ALSyntaxTreeSymbol symbolInfo = new ALSyntaxTreeSymbol(); symbolInfo.kind = ALSymbolKind.SyntaxTreeNode; symbolInfo.name = node.Kind.ToString(); symbolInfo.fullName = symbolInfo.name + " " + node.FullSpan.ToString(); symbolInfo.syntaxTreeNode = node; symbolInfo.type = node.GetType().Name; dynamic lineSpan = syntaxTree.GetLineSpan(node.FullSpan); symbolInfo.range = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.EndLinePosition.Line, lineSpan.EndLinePosition.Character); lineSpan = syntaxTree.GetLineSpan(node.Span); symbolInfo.selectionRange = new Range(lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character, lineSpan.StartLinePosition.Line, lineSpan.StartLinePosition.Character); IEnumerable <dynamic> list = node.ChildNodes(); if (list != null) { foreach (dynamic childNode in list) { symbolInfo.AddChildSymbol(ProcessSyntaxTreeNode(syntaxTree, childNode)); } } return(symbolInfo); }
static void Main(string[] args) { ALDevToolsServer alDevToolsServer = new ALDevToolsServer("C:\\Users\\azwie\\.vscode\\extensions\\ms-dynamics-smb.al-5.0.280447"); string filePath = ""; ALSyntaxTreeSymbolsReader syntaxTreeReader = new ALSyntaxTreeSymbolsReader(); ALSyntaxTreeSymbol symbol = syntaxTreeReader.ProcessSourceFile(filePath); }
protected override async Task <GetSyntaxTreeSymbolResponse> HandleMessage(GetSyntaxTreeSymbolRequest parameters, RequestContext <GetSyntaxTreeSymbolResponse> context) { ALSyntaxTree syntaxTree = this.Server.SyntaxTrees.FindOrCreate(parameters.path, false); ALSyntaxTreeSymbol symbol = syntaxTree.GetSyntaxTreeSymbolByPath(parameters.symbolPath); if (symbol != null) { symbol = symbol.CreateSerializableCopy(); } GetSyntaxTreeSymbolResponse response = new GetSyntaxTreeSymbolResponse(); response.symbol = symbol; return(response); }