11import { CancellationToken , Diagnostic , LSPErrorCodes , PublishDiagnosticsParams , ResponseError , SemanticTokens , SymbolInformation , SymbolKind } from 'vscode-languageserver' ;
22import { Workspace } from './workspace' ;
33import { FoldableElement } from './elements/special' ;
4- import { BaseSyntaxElement , HasAttribute , HasDiagnosticCapability , HasSemanticToken , HasSymbolInformation } from './elements/base' ;
4+ import { BaseSyntaxElement , HasDiagnosticCapability , HasSemanticToken , HasSymbolInformation , ScopeElement } from './elements/base' ;
55import { Range , TextDocument } from 'vscode-languageserver-textdocument' ;
66import { SyntaxParser } from './parser/vbaSyntaxParser' ;
77import { FoldingRange } from '../capabilities/folding' ;
@@ -10,18 +10,18 @@ import { sleep } from '../utils/helpers';
1010
1111
1212export abstract class BaseProjectDocument {
13+ readonly name : string ;
1314 readonly workspace : Workspace ;
1415 readonly textDocument : TextDocument ;
15- readonly name : string ;
1616
17+ protected _hasDiagnosticElements : HasDiagnosticCapability [ ] = [ ] ;
1718 protected _unhandledNamedElements : [ ] = [ ] ;
1819 protected _publicScopeDeclarations : Map < string , any > = new Map ( ) ;
1920 protected _documentScopeDeclarations : Map < string , Map < string , any > > = new Map ( ) ;
20- protected _hasDiagnosticElements : HasDiagnosticCapability [ ] = [ ] ;
2121
2222 protected _diagnostics : Diagnostic [ ] = [ ] ;
23- protected _elementParents : BaseSyntaxElement [ ] = [ ] ;
24- protected _attributeElements : HasAttribute [ ] = [ ] ;
23+ protected _elementParents : ScopeElement [ ] = [ ] ;
24+ // protected _attributeElements: HasAttribute[] = [];
2525 protected _foldableElements : FoldingRange [ ] = [ ] ;
2626 protected _symbolInformations : SymbolInformation [ ] = [ ] ;
2727 protected _semanticTokens : SemanticTokensManager = new SemanticTokensManager ( ) ;
@@ -33,10 +33,14 @@ export abstract class BaseProjectDocument {
3333 return this . _isBusy ;
3434 }
3535
36- get activeAttributeElement ( ) {
37- return this . _attributeElements ?. at ( - 1 ) ;
36+ get currentScopeElement ( ) {
37+ return this . _elementParents [ - 1 ] ;
3838 }
3939
40+ // get activeAttributeElement() {
41+ // return this._attributeElements?.at(-1);
42+ // }
43+
4044 constructor ( workspace : Workspace , name : string , document : TextDocument ) {
4145 this . textDocument = document ;
4246 this . workspace = workspace ;
@@ -121,10 +125,10 @@ export abstract class BaseProjectDocument {
121125 * @param element the element to register.
122126 * @returns nothing of interest.
123127 */
124- registerAttributeElement = ( element : HasAttribute ) => {
125- this . _attributeElements . push ( element ) ;
126- return this ;
127- } ;
128+ // registerAttributeElement = (element: HasAttribute) => {
129+ // this._attributeElements.push(element);
130+ // return this;
131+ // };
128132
129133 /**
130134 * Pops an element from the attribute elements stack.
@@ -133,9 +137,9 @@ export abstract class BaseProjectDocument {
133137 * @param element the element to register.
134138 * @returns the element at the end of the stack.
135139 */
136- deregisterAttributeElement = ( ) => {
137- return this . _attributeElements . pop ( ) ;
138- } ;
140+ // deregisterAttributeElement = () => {
141+ // return this._attributeElements.pop();
142+ // };
139143
140144 registerFoldableElement = ( element : FoldableElement ) => {
141145 this . _foldableElements . push ( new FoldingRange ( element ) ) ;
@@ -153,7 +157,7 @@ export abstract class BaseProjectDocument {
153157 * @param element the element to register.
154158 * @returns this for chaining.
155159 */
156- registerScopedElement ( element : BaseSyntaxElement ) {
160+ registerScopedElement ( element : ScopeElement ) {
157161 this . _elementParents . push ( element ) ;
158162 return this ;
159163 }
0 commit comments