@@ -10,8 +10,8 @@ var CompTypes = require("./grammar/CompletionTypes.json") // Constant 20 Functio
1010var HoverData = require ( "./grammar/HoverData.json" ) ;
1111var Encryption = require ( "./grammar/Encryption.json" ) ;
1212
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() {}}
1515
1616var enumCompTypeText = {
1717 1 : "method" ,
@@ -166,11 +166,20 @@ function activate(context) {
166166 // If its a function type return the function hover
167167 if ( assignment . startsWith ( "function" ) ) {
168168 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!` ;
172181 hoverText . appendCodeblock ( "(function) " + word + "(" + assignment . match ( / (?< = \( ) ( .* ?) (? = \) ) / ) [ 0 ] + ")" )
173- if ( description ) hoverText . appendText ( description ) ;
182+ if ( description && description != `` ) hoverText . appendText ( description ) ;
174183 return new vscode . Hover ( hoverText ) ;
175184 }
176185 }
@@ -1012,4 +1021,4 @@ let collection = vscode.languages.createDiagnosticCollection("greyscript");
10121021
10131022function deactivate ( ) { }
10141023
1015- module . exports = { activate, deactivate} ;
1024+ module . exports = { activate, deactivate} ;
0 commit comments