Skip to content

Commit

Permalink
repair outline parsing of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ironsheep committed Dec 1, 2023
1 parent f0597ca commit 4bf9f46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions spin2/server/src/parser/spin1.documentSymbolParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ export class Spin1DocumentSymbolParser {
const line = document.getText(desiredLineRange).replace(/\s+$/, "");
const lineRange: lsp.Range = { start: { line: i, character: 0 }, end: { line: i, character: line.length - 1 } };
const trimmedLine = line.trim();
const nonCommentLine = this.parseUtils.getRemainderWOutTrailingTicComment(0, line);
let nonCommentLine = this.parseUtils.getRemainderWOutTrailingTicComment(0, line);
if (nonCommentLine.length == 0) {
nonCommentLine = trimmedLine; // all comment, but parser has to see it!
}

let linePrefix: string = line;
let lineHasComment: boolean = false;
let commentOffset: number = 0;
let commentLength: number = 0;

if (nonCommentLine.trim().length == 0) {
if (nonCommentLine.trim().length == 0 && !trimmedLine.startsWith("'")) {
// skip only white-space lines
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion spin2/server/src/parser/spin2.documentSemanticParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Spin2DocumentSemanticParser {

private bLogStarted: boolean = false;
// adjust following true/false to show specific parsing debug
private spin2DebugLogEnabled: boolean = true; // WARNING (REMOVE BEFORE FLIGHT)- change to 'false' - disable before commit
private spin2DebugLogEnabled: boolean = false; // WARNING (REMOVE BEFORE FLIGHT)- change to 'false' - disable before commit
private showSpinCode: boolean = true;
private showPreProc: boolean = true;
private showCON: boolean = true;
Expand Down
7 changes: 5 additions & 2 deletions spin2/server/src/parser/spin2.documentSymbolParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ export class Spin2DocumentSymbolParser {
const line = document.getText(desiredLineRange).replace(/\s+$/, "");
const lineRange: lsp.Range = { start: { line: i, character: 0 }, end: { line: i, character: line.length - 1 } };
const trimmedLine = line.trim();
const nonCommentLine = this.parseUtils.getRemainderWOutTrailingTicComment(0, line);
let nonCommentLine = this.parseUtils.getRemainderWOutTrailingTicComment(0, line);
if (nonCommentLine.length == 0) {
nonCommentLine = trimmedLine; // all comment, but parser has to see it!
}

let linePrefix: string = line;
let lineHasComment: boolean = false;
let commentOffset: number = 0;
let commentLength: number = 0;

if (nonCommentLine.trim().length == 0) {
if (nonCommentLine.trim().length == 0 && !trimmedLine.startsWith("'")) {
// skip only white-space lines
continue;
}
Expand Down

0 comments on commit 4bf9f46

Please sign in to comment.