@@ -93,12 +93,25 @@ export async function viewOthers(forceEditable = false): Promise<void> {
93
93
return info . result . content [ 0 ] . others ;
94
94
} ;
95
95
96
+ const methodLangIsCOS = ( line : string ) : boolean => {
97
+ let result = true ;
98
+ const keywordsmatch : RegExpMatchArray = line . slice ( line . indexOf ( "[" ) ) . match ( / l a n g u a g e + = + ( [ a - z ] + ) / i) ;
99
+ if ( keywordsmatch !== null && keywordsmatch [ 1 ] !== "objectscript" ) {
100
+ result = false ;
101
+ }
102
+ return result ;
103
+ } ;
104
+
96
105
const api = new AtelierAPI ( file . uri ) ;
97
106
let indexarg : string = file . name ;
98
107
const cursorpos : vscode . Position = vscode . window . activeTextEditor . selection . active ;
99
108
const fileExt : string = file . name . split ( "." ) . pop ( ) . toLowerCase ( ) ;
100
109
101
- if ( api . config . apiVersion >= 4 && ( fileExt === "cls" || fileExt === "mac" || fileExt === "int" ) ) {
110
+ if (
111
+ api . config . apiVersion >= 4 &&
112
+ ( fileExt === "cls" || fileExt === "mac" || fileExt === "int" ) &&
113
+ ! / ^ % s q l c q / i. test ( indexarg )
114
+ ) {
102
115
// Send the server the current position in the document appended to the name if it supports it
103
116
let symbols : vscode . DocumentSymbol [ ] = await vscode . commands . executeCommand (
104
117
"vscode.executeDocumentSymbolProvider" ,
@@ -127,6 +140,7 @@ export async function viewOthers(forceEditable = false): Promise<void> {
127
140
// The current position is in a symbol that we can convert into a label+offset that the server understands
128
141
let offset : number = cursorpos . line - currentSymbol . selectionRange . start . line ;
129
142
143
+ let isObjectScript = true ;
130
144
if ( fileExt === "cls" ) {
131
145
// Need to find the actual start of the method
132
146
const currentdoc : vscode . TextDocument = vscode . window . activeTextEditor . document ;
@@ -139,13 +153,30 @@ export async function viewOthers(forceEditable = false): Promise<void> {
139
153
if ( methodlinetext . endsWith ( "{" ) ) {
140
154
// This is the last line of the method definition, so count from here
141
155
offset = cursorpos . line - methodlinenum ;
156
+
157
+ // Look for the Language compiler keyword
158
+ if ( methodlinetext . indexOf ( "[" ) !== - 1 ) {
159
+ // Compiler keywords are on this line
160
+ isObjectScript = methodLangIsCOS ( methodlinetext ) ;
161
+ } else {
162
+ // Check the previous line for compiler keywords
163
+ const prevlinetext : string = currentdoc . lineAt ( methodlinenum - 1 ) . text . trim ( ) ;
164
+ if ( prevlinetext . indexOf ( "[" ) !== - 1 ) {
165
+ // Compiler keywords are on this line
166
+ isObjectScript = methodLangIsCOS ( prevlinetext ) ;
167
+ }
168
+ }
169
+
142
170
break ;
143
171
}
144
172
}
145
173
}
146
174
147
175
offset = offset < 0 ? 0 : offset ;
148
- indexarg = indexarg + ":" + currentSymbol . name + "+" + offset ;
176
+ if ( isObjectScript ) {
177
+ // Only provide label+offset if method language is ObjectScript
178
+ indexarg = indexarg + ":" + currentSymbol . name + "+" + offset ;
179
+ }
149
180
}
150
181
}
151
182
}
0 commit comments