@@ -6,7 +6,7 @@ import { SemanticToken } from '../capabilities/vbaSemanticTokens';
66import { vbaTypeToSymbolConverter } from './converters' ;
77import { stripQuotes } from './helpers' ;
88
9- export { SyntaxElement , ModuleElement , ModuleAttribute , MethodElement , EnumElement , EnumConstant , VariableStatementElement , VariableDeclarationElement , VariableAssignElement , IdentifierElement , getCtxOriginalText } ;
9+ export { SyntaxElement , UnknownElement , ModuleElement , ModuleAttribute , MethodElement , EnumElement , EnumConstant , VariableStatementElement , VariableDeclarationElement , VariableAssignElement , IdentifierElement } ;
1010
1111interface SyntaxElement {
1212 uri : string ;
@@ -52,7 +52,7 @@ abstract class BaseElement implements SyntaxElement {
5252 this . uri = doc . uri ;
5353 this . context = ctx ;
5454 this . range = getCtxRange ( ctx , doc ) ;
55- this . text = doc . getText ( this . range ) ;
55+ this . text = ctx . text ;
5656 this . setIdentifierFromDoc ( doc ) ;
5757 this . symbolKind = SymbolKind . Null ;
5858 this . hoverText = '' ;
@@ -110,6 +110,10 @@ abstract class BaseElement implements SyntaxElement {
110110 'ambiguousIdentifier' in o ;
111111}
112112
113+ class UnknownElement extends BaseElement {
114+
115+ }
116+
113117class IdentifierElement extends BaseElement {
114118 constructor ( ctx : AmbiguousIdentifierContext | LiteralContext , doc : TextDocument ) {
115119 super ( ctx , doc ) ;
@@ -331,11 +335,6 @@ class TypeContext extends BaseElement {
331335 }
332336}
333337
334- function getCtxOriginalText ( ctx : ParserRuleContext , doc : TextDocument ) : string {
335- const range = getCtxRange ( ctx , doc ) ;
336- return doc . getText ( range ) ;
337- }
338-
339338function getCtxRange ( ctx : ParserRuleContext , doc : TextDocument ) : Range {
340339 const start = ctx . start . startIndex ;
341340 const stop = ctx . stop ?. stopIndex ?? start ;
0 commit comments