Skip to content

Commit f9a7e7a

Browse files
author
Wyatt Lipscomb
committed
Update function hints; bump 1.9.3
1 parent 48dfa0d commit f9a7e7a

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.9.3
2+
- Updated function hints, comments may now be placed one line above, on the same line, or a line below the function definition.
3+
14
# 1.9.2
25
- Updated grammar to latest version of the game.
36
- Fix "Go to Declaration" ([#25](https://github.com/WyattSL/greyscript/issues/25))

extension.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ var CompTypes = require("./grammar/CompletionTypes.json") // Constant 20 Functio
1010
var HoverData = require("./grammar/HoverData.json");
1111
var 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

1616
var 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

10131022
function deactivate() {}
10141023

1015-
module.exports = {activate, deactivate};
1024+
module.exports = {activate, deactivate};

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/WyattSL"
1010
},
1111
"icon": "icon.png",
12-
"version": "1.9.2",
12+
"version": "1.9.3",
1313
"repository": {
1414
"type": "git",
1515
"url": "https://github.com/WyattSL/greyscript.git"

0 commit comments

Comments
 (0)