-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
extension/test/electron/definition/document-highlights.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const assert = require('node:assert'); | ||
const path = require('node:path'); | ||
const vscode = require('vscode'); | ||
const { showFile, sleepCI } = require('../util'); | ||
|
||
const stylesUri = vscode.Uri.file( | ||
path.resolve(__dirname, 'fixtures', 'styles.scss') | ||
); | ||
|
||
before(async () => { | ||
await showFile(stylesUri); | ||
await sleepCI(); | ||
}); | ||
|
||
after(async () => { | ||
await vscode.commands.executeCommand('workbench.action.closeAllEditors'); | ||
}); | ||
|
||
/** | ||
* @param {import('vscode').Uri} documentUri | ||
* @returns {Promise<Array<import('vscode').DocumentHighlight>>} | ||
*/ | ||
async function getHighlights(documentUri, position) { | ||
const result = await vscode.commands.executeCommand( | ||
'vscode.executeDocumentHighlights', | ||
documentUri, | ||
position | ||
); | ||
return result; | ||
} | ||
|
||
test('gets document highlights', async () => { | ||
const [first, second] = await getHighlights( | ||
stylesUri, | ||
new vscode.Position(7, 5) | ||
); | ||
|
||
assert.ok(first, 'Should have found highlights'); | ||
assert.ok(second, 'Should have found two highlights'); | ||
|
||
assert.equal(first.range.start.line, 7); | ||
assert.equal(first.range.start.character, 2); | ||
|
||
assert.equal(first.range.end.line, 7); | ||
assert.equal(first.range.end.character, 14); | ||
|
||
assert.equal(second.range.start.line, 11); | ||
assert.equal(second.range.start.character, 13); | ||
|
||
assert.equal(second.range.end.line, 11); | ||
assert.equal(second.range.end.character, 25); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,11 @@ | |
.a { | ||
@extend %brand; | ||
} | ||
|
||
:root { | ||
--color-text: #000; | ||
} | ||
|
||
body { | ||
color: var(--color-text); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters