File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
server/src/project/elements Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -32,15 +32,26 @@ abstract class BaseModuleElement extends BaseContextSyntaxElement implements Has
3232}
3333
3434export class ModuleElement extends BaseModuleElement implements ScopeElement {
35+ context : ProceduralModuleContext ;
3536 protected _name : string ;
3637
3738 constructor ( context : ProceduralModuleContext , document : TextDocument ) {
3839 super ( context , document , SymbolKind . File ) ;
40+ this . context = context ;
3941 this . _name = this . _getName ( context ) ;
4042 }
4143
4244 evaluateDiagnostics ( ) : void {
43- return ;
45+ if ( ! this . _hasOptionExplicit ( ) ) {
46+ const header = this . context . proceduralModuleHeader ( ) ;
47+ const startLine = header . stop ?. line ?? 0 + 1 ;
48+ this . diagnostics . push ( new MissingOptionExplicitDiagnostic (
49+ Range . create (
50+ startLine , 1 ,
51+ startLine , 1
52+ )
53+ ) ) ;
54+ }
4455 }
4556
4657 private _getName ( context : ProceduralModuleContext ) {
@@ -56,6 +67,21 @@ export class ModuleElement extends BaseModuleElement implements ScopeElement {
5667
5768 return name ?. stripQuotes ( ) ?? 'Unknown Module' ;
5869 }
70+
71+ private _hasOptionExplicit ( ) : boolean {
72+ const moduleDeclarations = this . context . proceduralModuleBody ( ) . proceduralModuleDeclarationSection ( ) ?. proceduralModuleDeclarationElement ( ) ;
73+ if ( ! moduleDeclarations ) {
74+ return false ;
75+ }
76+
77+ for ( const declaration of moduleDeclarations ) {
78+ if ( declaration . commonOptionDirective ( ) ?. optionExplicitDirective ( ) ) {
79+ return true ;
80+ }
81+ }
82+
83+ return false ;
84+ }
5985}
6086
6187export class ClassElement extends BaseModuleElement {
You can’t perform that action at this time.
0 commit comments