Skip to content

Commit

Permalink
Trim hover message (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyklish authored Jan 19, 2023
1 parent 410c97b commit ce83f4c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export class Parser {
) {
if (line >= 0) {
const { text } = document.lineAt(line);
const markMatch = text.match(/^\s*;(.+)/);
const markMatch = text.match(/^\s*;\s*(.+)/);
if (markMatch) {
return markMatch[1];
}
Expand Down
37 changes: 37 additions & 0 deletions src/test/suite/parser/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,41 @@ suite('Parser', () => {
});
});
});

suite('getRemarkByLine', () => {
// List of test data
let dataList = [
// {
// in: // input test string
// rs: // expected result
// },
{
in: ';comment',
rs: 'comment',
},
{
in: '; comment',
rs: 'comment',
},
{
in: ' ;comment',
rs: 'comment',
},
{
in: ' ; comment',
rs: 'comment',
},
];
dataList.forEach((data) => {
test("'" + data.in + "' => '" + data.rs + "'", async () => {
const document = await vscode.workspace.openTextDocument({
language: 'ahk',
content: data.in,
});
// Use array access for the private members
const comment = Parser['getRemarkByLine'](document, 0);
assert.strictEqual(comment, data.rs);
});
});
});
});

0 comments on commit ce83f4c

Please sign in to comment.