@@ -11,7 +11,7 @@ export class ObjectScriptDiagnosticProvider {
11
11
this . _collection = vscode . languages . createDiagnosticCollection ( "ObjectScript" ) ;
12
12
}
13
13
14
- public updateDiagnostics ( document : vscode . TextDocument ) {
14
+ public updateDiagnostics ( document : vscode . TextDocument ) : void {
15
15
if ( document . languageId . startsWith ( "objectscript" ) ) {
16
16
this . _collection . set ( document . uri , [
17
17
...this . classMembers ( document ) ,
@@ -47,7 +47,7 @@ export class ObjectScriptDiagnosticProvider {
47
47
}
48
48
49
49
const memberMatch = text . match (
50
- / ^ ( C l a s s | P r o p e r t y | R e l a t i o n s h i p | I n d e x | (?: (?: C l i e n t ) ? (?: C l a s s ) ? M e t h o d ) | C l i e n t C l a s s M e t h o d | M e t h o d | X D a t a | Q u e r y | T r i g g e r | F o r e i g n K e y | P r o j e c t i o n | P a r a m e t e r ) \s ( \b [ ^ ( ] + \b ) / i
50
+ / ^ ( C l a s s | P r o p e r t y | R e l a t i o n s h i p | I n d e x | (?: (?: C l i e n t ) ? (?: C l a s s ) ? M e t h o d ) | C l i e n t C l a s s M e t h o d | M e t h o d | X D a t a | Q u e r y | T r i g g e r | F o r e i g n K e y | P r o j e c t i o n | P a r a m e t e r ) \s ( (?: " [ ^ " ] + " ) | (?: [ ^ ( ; ] + ) ) / i
51
51
) ;
52
52
if ( memberMatch ) {
53
53
const [ fullMatch , type , name ] = memberMatch ;
@@ -72,6 +72,25 @@ export class ObjectScriptDiagnosticProvider {
72
72
} ) ;
73
73
}
74
74
map . set ( key , fullMatch ) ;
75
+
76
+ let leftChars ;
77
+ if ( ! name . startsWith ( '"' ) && ( leftChars = name . replace ( / [ % a - z 0 - 9 . ] / gi, "" ) ) && leftChars !== "" ) {
78
+ const pos = line . text . indexOf ( name ) ;
79
+ const range = new vscode . Range ( new vscode . Position ( i , pos ) , new vscode . Position ( i , pos + name . length ) ) ;
80
+ result . push ( {
81
+ code : "" ,
82
+ message : "Non-latin characters" ,
83
+ range,
84
+ severity : vscode . DiagnosticSeverity . Warning ,
85
+ source : "" ,
86
+ relatedInformation : [
87
+ new vscode . DiagnosticRelatedInformation (
88
+ new vscode . Location ( document . uri , range ) ,
89
+ `Element name contains non-latin characters: ${ leftChars } `
90
+ ) ,
91
+ ] ,
92
+ } ) ;
93
+ }
75
94
}
76
95
}
77
96
0 commit comments