@@ -10,8 +10,8 @@ var CompTypes = require("./grammar/CompletionTypes.json") // Constant 20 Functio
10
10
var HoverData = require ( "./grammar/HoverData.json" ) ;
11
11
var Encryption = require ( "./grammar/Encryption.json" ) ;
12
12
13
- // var bugout = vscode.window.createOutputChannel("Greyscript Debugger");
14
- var bugout = { appendLine : function ( ) { } }
13
+ var bugout = vscode . window . createOutputChannel ( "Greyscript Debugger" ) ;
14
+ // var bugout = { appendLine: function() {}}
15
15
16
16
var enumCompTypeText = {
17
17
1 : "method" ,
@@ -166,11 +166,20 @@ function activate(context) {
166
166
// If its a function type return the function hover
167
167
if ( assignment . startsWith ( "function" ) ) {
168
168
let description = null ;
169
- if ( linesTillCurLine [ linesTillCurLine . indexOf ( lines [ lines . length - 1 ] ) + 1 ] . startsWith ( "//" ) ) {
170
- description = linesTillCurLine [ linesTillCurLine . indexOf ( lines [ lines . length - 1 ] ) + 1 ] . substring ( 2 ) . trim ( ) ;
171
- }
169
+ //if(linesTillCurLine[linesTillCurLine.indexOf(lines[lines.length - 1]) + 1].startsWith("//")){
170
+ // description = linesTillCurLine[linesTillCurLine.indexOf(lines[lines.length - 1]) + 1].substring(2).trim();
171
+ let preline = linesTillCurLine [ linesTillCurLine . indexOf ( lines [ lines . length - 1 ] ) + 1 ]
172
+ let thisline = document . getText ( new vscode . Range ( new vscode . Position ( position . line , 0 ) , new vscode . Position ( position . line + 1 , 0 ) ) ) . replace ( `\n` , `` )
173
+ let postline = document . getText ( new vscode . Range ( new vscode . Position ( position . line + 1 , 0 ) , new vscode . Position ( position . line + 2 , 0 ) ) ) . replace ( `\n` , `` )
174
+ bugout . appendLine ( preline + `\n` + thisline + `\n` + postline )
175
+ bugout . appendLine ( new vscode . Position ( position . line , 0 ) + `\n` + new vscode . Position ( position . line + 1 , 0 ) + `\n` + new vscode . Range ( new vscode . Position ( position . line , 0 ) , new vscode . Position ( position . line + 1 , 0 ) ) )
176
+ if ( preline . includes ( "//" ) ) description = preline . replace ( `//` , `` ) ;
177
+ if ( thisline . includes ( "//" ) ) description = thisline . split ( `//` ) [ 1 ] ;
178
+ if ( postline . includes ( "//" ) ) description = postline . replace ( `//` , `` ) ;
179
+ if ( ! description ) description = `` ;
180
+ if ( word . includes ( "gk" ) ) description += `\ngk258 is my hero!` ;
172
181
hoverText . appendCodeblock ( "(function) " + word + "(" + assignment . match ( / (?< = \( ) ( .* ?) (? = \) ) / ) [ 0 ] + ")" )
173
- if ( description ) hoverText . appendText ( description ) ;
182
+ if ( description && description != `` ) hoverText . appendText ( description ) ;
174
183
return new vscode . Hover ( hoverText ) ;
175
184
}
176
185
}
@@ -1012,4 +1021,4 @@ let collection = vscode.languages.createDiagnosticCollection("greyscript");
1012
1021
1013
1022
function deactivate ( ) { }
1014
1023
1015
- module . exports = { activate, deactivate} ;
1024
+ module . exports = { activate, deactivate} ;
0 commit comments