Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for indented syntax #214

Merged
merged 143 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
da0ca59
refactor: split?
wkillerud May 13, 2024
fbbe322
Revert "refactor: split?"
wkillerud May 13, 2024
2c6e6c1
refactor: use vitest across the board
wkillerud May 13, 2024
91694a7
refactor: rename to sass* and add dialect option
wkillerud May 14, 2024
950e82b
test: hello, indented
wkillerud May 14, 2024
21bcb36
refactor: fix comment parsing
wkillerud May 20, 2024
55e9485
refactor: consume the preceeding whitespace also when not indent or d…
wkillerud May 20, 2024
7987b5c
refactor: restore the depth when going back in the stream
wkillerud May 22, 2024
9992b75
refactor: no semicolon errors in indented
wkillerud May 22, 2024
a023214
refactor: adapt to not necesarily matching amount of dedent
wkillerud May 22, 2024
92f0cee
test: test coverage
wkillerud May 22, 2024
7b01be8
test: property
wkillerud May 23, 2024
80ba211
test: import
wkillerud May 23, 2024
b3db600
test: supports
wkillerud May 23, 2024
dba9158
test: media
wkillerud May 23, 2024
a16a91a
test: bunch of stuff
wkillerud May 23, 2024
ee2ce72
refactor: ruleset parsing
wkillerud May 23, 2024
1ba8977
test: ruleset errors
wkillerud May 23, 2024
79e595e
test: nested ruleset
wkillerud May 23, 2024
56df451
test: all the rest of CSS test suite
wkillerud May 23, 2024
680e89f
test: tests from SCSS parser
wkillerud May 23, 2024
46544e6
test: at-root
wkillerud May 23, 2024
02e390d
test: function
wkillerud May 24, 2024
e06271e
refactor: include
wkillerud May 24, 2024
1495d47
refactor: nested declaration, at mixin
wkillerud May 24, 2024
8eab530
test: at-for
wkillerud May 24, 2024
47192d0
test: at-if
wkillerud May 24, 2024
4669154
test: at-media
wkillerud May 24, 2024
a8a214d
refactor: all parser tests passing
wkillerud May 24, 2024
c341f32
refactor: rename test folder
wkillerud May 24, 2024
27a15a4
test: indented selector printing
wkillerud May 24, 2024
571fde8
test: indented fixtures
wkillerud May 25, 2024
2d463a4
refactor: configure syntax based on textdocument
wkillerud May 25, 2024
2998e29
refactor: find document links sass indented
wkillerud May 25, 2024
9a4cbc1
test: scope navigation test
wkillerud May 25, 2024
13fc0a8
test: sass navigation tests
wkillerud May 25, 2024
cc67b38
refactor: indented completions
wkillerud May 30, 2024
40ad48a
test: sass indented linting
wkillerud Jun 16, 2024
f28b915
test: language facts indented
wkillerud Jun 16, 2024
c5211b9
refactor: selection range indented
wkillerud Jun 16, 2024
4510d47
test: selection range indented
wkillerud Jun 16, 2024
aabf877
refactor: hover indented
wkillerud Jun 16, 2024
5dd862c
refactor: folding indented
wkillerud Jun 16, 2024
bd6bb3b
refactor: completions indented
wkillerud Jun 16, 2024
547a35d
refactor: find symbols indented
wkillerud Jun 16, 2024
08d6a1b
refactor: hover indented minus SassDoc
wkillerud Jun 16, 2024
b1e4ec5
refactor: prep for indented syntax in sassdoc examples
wkillerud Jun 16, 2024
c3b8b22
refactor: add support for the sass file extension
wkillerud Jun 23, 2024
39d63a2
feat: syntax for sass indented
wkillerud Jun 23, 2024
f0e6778
fix: add support for unquoted import strings in indented
wkillerud Jun 23, 2024
f125ee8
fix: hover info for CSS
wkillerud Jul 3, 2024
331424e
chore: reset nx as part of clean script
wkillerud Jul 7, 2024
c87ab57
test: add test for diagnostics in sass-indented
wkillerud Jul 7, 2024
59ecfa6
chore: skip source maps since we ship a development build
wkillerud Jul 7, 2024
01b7d93
refactor: make onInitialized awaitable for other handlers
wkillerud Jul 7, 2024
a849bb3
refactor: add indented variant of code actions
wkillerud Jul 7, 2024
be6a4b3
refactor: selection and folding provider
wkillerud Jul 7, 2024
eb9aa8e
refactor: terminate ruleset if depth is zero
wkillerud Jul 7, 2024
80c8d7d
test: actually not only at the root where this bug is
wkillerud Jul 7, 2024
cd087c4
refactor: fix the dedent case also for non-root level
wkillerud Jul 7, 2024
2bdae99
chore: update scss-sassdoc-parser
wkillerud Jul 7, 2024
86d5b70
chore: replace with new package name
wkillerud Jul 7, 2024
6c141ce
refactor: trigger css property completions correctly
wkillerud Jul 14, 2024
ff45acd
refactor: fix parser error with custom properties in sass
wkillerud Jul 14, 2024
085233b
refactor: wip completions
wkillerud Jul 14, 2024
269f023
refactor: fix parser error with nested stuff
wkillerud Jul 14, 2024
91b8f9a
refactor: fix parser bug indented custom property expression
wkillerud Jul 14, 2024
7c2f214
refactor: fix a completions bug where use and import duplicated
wkillerud Jul 14, 2024
81f88df
refactor: add completions for sassdoc blocks to indented
wkillerud Jul 14, 2024
b772729
refactor: shorthand include
wkillerud Jul 21, 2024
a3a28d9
refactor: shorthand declare
wkillerud Jul 21, 2024
2553c5b
refactor: fix parser bugs for shorthands
wkillerud Jul 21, 2024
c468b1f
refactor: mark an error if mixing between tabs and spaces
wkillerud Jul 21, 2024
957fa2d
refactor: sass indented comment syntax
wkillerud Jul 21, 2024
8613c34
refactor: allow newline after comma in selector
wkillerud Jul 23, 2024
90d2130
docs: how to take a performance profile
wkillerud Jul 23, 2024
c4391bf
perf: share the sassdoc parser instance
wkillerud Jul 23, 2024
72610c8
refactor: fix an edge case with comments
wkillerud Jul 23, 2024
f471676
refactor: fix a bug consuming dedents
wkillerud Jul 23, 2024
32afe85
test: failing test case
wkillerud Jul 23, 2024
bfa0319
Merge branch 'main' into experiment/indented
wkillerud Jul 28, 2024
7cd4cc1
Merge branch 'main' into experiment/indented
wkillerud Jul 30, 2024
201b537
Merge branch 'main' into experiment/indented
wkillerud Aug 4, 2024
1a486ea
test: fix loadPaths test after merge
wkillerud Aug 4, 2024
3d70774
refactor: handle selectors after comment in block
wkillerud Aug 4, 2024
0d188a1
refactor: fix multiline selectors for indented
wkillerud Aug 4, 2024
bf27fad
refactor: completions for sass indented
wkillerud Aug 4, 2024
94d4592
refactor: color decorators for css colors in sass
wkillerud Aug 4, 2024
4a75ec7
refactor: splitt settings per syntax
wkillerud Aug 4, 2024
06fd0f2
Merge branch 'main' into experiment/indented
wkillerud Aug 24, 2024
88854d3
refactor: simplify settings again for non-breaking change
wkillerud Aug 24, 2024
af27480
refactor: add code actions from upstream
wkillerud Aug 24, 2024
8d3f5f6
docs: note for the future
wkillerud Aug 24, 2024
3de2a1c
docs: fix docs after simplifying settings again
wkillerud Aug 24, 2024
9768ecb
refactor: e2e test suite to use the new rig
wkillerud Aug 24, 2024
2107acd
test: use qunit syntax
wkillerud Aug 24, 2024
a4325e0
refactor: add back missing settings from contributes
wkillerud Aug 24, 2024
6d03f49
test: add e2e suite and workspace for indented
wkillerud Aug 24, 2024
bb5b580
refactor: skip bracket suggestion for indented
wkillerud Aug 24, 2024
7992493
fix: syntax error for semi
wkillerud Aug 24, 2024
b040790
fix: find value referenced by value
wkillerud Aug 24, 2024
9fbd4a9
feat: diagnostics to help identify tabs vs spaces
wkillerud Aug 24, 2024
6360e0e
chore: fix disparate vitest versions
wkillerud Aug 24, 2024
c86d2a2
chore: delete unused files
wkillerud Aug 24, 2024
6e6f9d8
docs: include "how to run the thing" in getting started [skip ci]
wkillerud Aug 24, 2024
ae79224
chore: regenerate lockfile
wkillerud Aug 24, 2024
315b1b7
test: remove skipped test covered by different workspace
wkillerud Aug 25, 2024
9aa2988
test: configuration
wkillerud Aug 25, 2024
61e57f5
refactor: simplify context
wkillerud Aug 25, 2024
f2d7416
fix: regressions in completions
wkillerud Aug 25, 2024
a6f6ace
docs: note to self
wkillerud Aug 25, 2024
f8116b0
test: interaction with manual typing and accepting suggestion
wkillerud Aug 25, 2024
c63240f
test: typing test
wkillerud Aug 25, 2024
94c584e
test: regression test for #206
wkillerud Aug 25, 2024
cab358f
test: refactor
wkillerud Aug 25, 2024
05a2470
test: hover
wkillerud Aug 25, 2024
3d67a75
test: line endings
wkillerud Aug 25, 2024
7364543
docs: both syntaxes [skip ci]
wkillerud Aug 25, 2024
ead0a60
refactor: review comments
wkillerud Aug 26, 2024
aa4af68
test: mixed syntaxes
wkillerud Aug 26, 2024
efe9524
chore: lint warnings
wkillerud Aug 26, 2024
b3f5a4a
perf: skip the extra parse call if cached
wkillerud Aug 28, 2024
7d84cfb
test: rename, add test of example stylesheets
wkillerud Aug 28, 2024
b204064
fix: parser issue with odd import
wkillerud Aug 28, 2024
9741699
docs: contrib syntax
wkillerud Aug 28, 2024
48fbcaf
chore: simplify
wkillerud Aug 28, 2024
dcc9c47
chore: test with adapting scss
wkillerud Aug 28, 2024
22ab5a5
fix: wip
wkillerud Aug 28, 2024
d8a289d
refactor: use the scss syntax as a basis, adapt
wkillerud Aug 31, 2024
9a39bd3
fix: emmet suggestions showing up after modules
wkillerud Aug 31, 2024
181b8a4
test: fix unused variable names [skip ci]
wkillerud Aug 31, 2024
e108670
fix: syntax highlighting
wkillerud Aug 31, 2024
7e03e98
test: give editor time to exclude Emmet
wkillerud Aug 31, 2024
cc8910c
chore: issue template [skip ci]
wkillerud Aug 31, 2024
f3eeb2b
fix: avoid duplicate placeholders if not suggestFromUseOnly
wkillerud Sep 4, 2024
9f85cd6
test: add test for local scope variable
wkillerud Sep 4, 2024
c1e68b2
fix: rename scoped symbol
wkillerud Sep 4, 2024
b639cd5
fix: signature help for certain Sass built-ins
wkillerud Sep 4, 2024
3ec49e0
chore: update node
wkillerud Sep 4, 2024
157a8a4
Merge branch 'main' into experiment/indented
wkillerud Sep 4, 2024
4be4616
chore: update web data
wkillerud Sep 4, 2024
3dd5d2c
chore: sync with upstream
wkillerud Sep 4, 2024
97c0c6c
chore: update test-web
wkillerud Sep 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/01-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Bug report"
description: Report an issue or possible bug
labels: []
assignees: []
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to file a bug report! Please fill out this form as completely as possible.

✅ I am using the latest version of Some Sass.
✅ I am using the latest version of my editor.
- type: input
id: editor
attributes:
label: In which editor is this a problem?
description: If you use an editor other than VS Code or VSCodium, please try to reproduce the issue in either of those editors and let us know if it works there or not.
value: Visual Studio Code
validations:
required: true
- type: textarea
id: bug-description
attributes:
label: Describe the bug
validations:
required: true
- type: textarea
id: bug-expectation
attributes:
label: What's the expected result?
description: Describe what you expect to happen.
validations:
required: true
- type: input
id: bug-reproduction
attributes:
label: Link to minimal reproducible example
description: 'A minimal reproduction is required. If a report is vague (e.g. just a generic error message) and has no reproduction, it may be closed. Not sure how to create a minimal example? [Read our guide](https://wkillerud.github.io/some-sass/contributing/reporting-bugs.html)'
placeholder: 'https://github.com/wkillerud/some-sass-issue-template'
- type: checkboxes
id: will-pr
attributes:
label: Participation
options:
- label: I am willing to submit a pull request for this issue.
required: false
23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/bug.md

This file was deleted.

8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Ideas for new features, improvements
url: https://github.com/wkillerud/some-sass/discussions
about: Suggest additions or improvements to Some Sass in Discussions
- name: Questions when setting up Some Sass in an editor
url: https://github.com/wkillerud/some-sass/discussions
about: Please use Discussions if you have questions when configuring a language server client in a new editor
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ npm-debug.log*

# Dependency directory
node_modules/
!vscode-extension/test/fixtures/node_modules
!vscode-extension/test/fixtures/completion/node_modules
!vscode-extension/test/fixtures/pkg-import/node_modules
!vscode-extension/test/**/node_modules

# Compiled and temporary files
dist/
Expand All @@ -30,3 +28,6 @@ docs/book/

.nx/cache
.nx/workspace-data

*.cpuprofile
*.heapprofile
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.16.0
20.17.0
11 changes: 0 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
],
"outFiles": ["${workspaceFolder}/vscode-extension/dist/browser-*.js"],
"autoAttachChildProcesses": true
},
{
"name": "Launch end-to-end tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/vscode-extension",
"--extensionTestsPath=${workspaceFolder}/vscode-extension/test/e2e/suite",
"${workspaceFolder}/vscode-extension/test/fixtures/"
]
}
]
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Some Sass

Some Sass is a [language server extension][langext] for [Visual Studio Code][vscode]. It brings improved code suggestions, documentation and code navigation for [SCSS][scss].
Some Sass is a [language server extension][langext] for [Visual Studio Code][vscode]. It brings improved code suggestions, documentation and code navigation for both [SCSS][scss] and [indented] syntaxes.

Some features include:

- Full support for [`@use`][use] and [`@forward`][forward], including aliases, prefixes and hiding.
- Workspace-wide code navigation and refactoring, such as Rename Symbol.
- Rich documentation through [SassDoc][sassdoc].
- Language features for [`%placeholders`][placeholder], both when using them and writing them.
- Support for [both Sass syntaxes](https://sass-lang.com/documentation/syntax/).

![](./docs/src/images/highlight-reel.gif)

Expand Down
5 changes: 3 additions & 2 deletions docs/src/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Some Sass

Some Sass is a [language server extension][langext] for [Visual Studio Code][vscode]. It brings improved code suggestions, documentation and code navigation for [SCSS][scss].
Some Sass is a [language server extension][langext] for [Visual Studio Code][vscode]. It brings improved code suggestions, documentation and code navigation for both SCSS and indented Sass [syntaxes].

Some features include:

- Full support for [`@use`][use] and [`@forward`][forward], including aliases, prefixes and hiding.
- Workspace-wide code navigation and refactoring, such as Rename Symbol.
- Rich documentation through [SassDoc][sassdoc].
- Language features for [`%placeholders`][placeholder], both when using them and writing them.
- Support for both SCSS and intended [syntaxes].

![](./images/highlight-reel.gif)

Expand Down Expand Up @@ -35,7 +36,7 @@ To search click the magnifying class icon to the top left or press `s` on your k

[lsp]: https://microsoft.github.io/language-server-protocol/
[npm]: https://www.npmjs.com/package/some-sass-language-server
[scss]: https://sass-lang.com/documentation/syntax/
[syntaxes]: https://sass-lang.com/documentation/syntax/
[use]: https://sass-lang.com/documentation/at-rules/use/
[forward]: https://sass-lang.com/documentation/at-rules/forward/
[langext]: https://code.visualstudio.com/api/language-extensions/language-server-extension-guide
Expand Down
5 changes: 3 additions & 2 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Contributing to Some Sass

- [New contributors](contributing/new-contributors.md)
- [Reporting bugs](contributing/reporting-bugs.md)
- [Extensions for VS Code](contributing/extensions-for-vs-code.md)
- [Language Server Protocol](contributing/language-server-protocol.md)
- [Development environment](contributing/development-environment.md)
Expand All @@ -31,8 +32,8 @@
- [Automated tests](contributing/automated-tests.md)
- [Test coverage](contributing/test-coverage.md)
- [Debugging](contributing/debugging.md)
- [Debugging in the browser](contributing/debugging-in-browser.md)
- [Debugging unit tests](contributing/debugging-unit-tests.md)
- [Debugging end-to-end tests](contributing/debugging-e2e-tests.md)
- [Debugging performance](contributing/debugging-performance.md)
- [Debugging in the browser](contributing/debugging-in-browser.md)
- [Releasing new versions](contributing/releases.md)
- [Writing documentation](contributing/writing-documentation.md)
12 changes: 7 additions & 5 deletions docs/src/contributing/architecture.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Architecture

Being a [language server extension](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide), Some Sass consists of a [client](https://github.com/wkillerud/some-sass/blob/main/vscode-extension) and a [server](https://github.com/wkillerud/some-sass/blob/main/packages/language-server). The client starts the server when it opens a file with SCSS. This is called activation.
Being a [language server extension](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide), Some Sass consists of a [client](https://github.com/wkillerud/some-sass/blob/main/vscode-extension) and a [server](https://github.com/wkillerud/some-sass/blob/main/packages/language-server). The client starts the server when it opens a file with SCSS or Sass code. This is called activation.

From there everything happens via [messages](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/).

Expand All @@ -18,17 +18,17 @@ The code for the server is divided in three packages:

1. Language server
2. Language services
3. VS Code CSS language service – the SCSS parser and language features that are included in VS Code.
3. VS Code CSS language service

### Language server

This package handles communication with the language client, and not much else.
This package handles communication with the language client, scans the workspace for files to parse them, and not much else.

### Language services

This is where you find the functionality of the language server, organized in classes that inherit from a base `LanguageFeature` class.

All features will parse the given document, but parses are cached for performance reasons. The flow looks something like this:
All features will parse the given document, but parses are cached for performance. The flow looks something like this:

![](../images/architecture/parser-cache.png)

Expand All @@ -44,4 +44,6 @@ In addition to the parsed document, the cache also holds:

### VS Code CSS language service

The project includes a private fork of the `vscode-css-languageservice` module. The original `vscode-css-languageservice` powers the CSS, SCSS and Less features in Visual Studio Code. Some Sass uses this module's parser and some of its language features. It's kept as a separate package to simplify updates, and to make it easier to send patches upstream.
The project includes a private fork of the `vscode-css-languageservice` module. The original `vscode-css-languageservice` powers the CSS, SCSS and Less features in Visual Studio Code.

Some Sass extends this module's parser and some of its language features to support both syntaxes. It's kept as a separate package to simplify updates, and to make it easier to send patches upstream.
5 changes: 2 additions & 3 deletions docs/src/contributing/automated-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All packages in `packages/` have unit tests. To run them:
npm run test
```

The main test runner is [Vitest]. `vscode-css-languageservice` uses [Mocha].
The test runner is [Vitest].

Unit tests typically cover either a utility function or a language feature such as `doHover`. For language features the tests are typically split in several files, each focusing on part of the functionality of the language feature.

Expand All @@ -28,7 +28,7 @@ It also includes end-to-end tests for the web extension. To run them:
npm run test:web
```

The end-to-end tests have some overlap with the unit tests for language features, but are useful to confirm the communication between client and server works as expected.
The end-to-end tests have some overlap with the unit tests for language features, but are useful to confirm the communication between client and server works as expected. It's also the most practical way to test the `language-server` module.

## Run all tests

Expand All @@ -39,4 +39,3 @@ npm run test:all
```

[Vitest]: https://vitest.dev/
[Mocha]: https://mochajs.org/
1 change: 1 addition & 0 deletions docs/src/contributing/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ If something unexpected happens with your build you can do a clean build:

```sh
npm run clean
npm run clean-install
npm run build
```

Expand Down
20 changes: 0 additions & 20 deletions docs/src/contributing/debugging-e2e-tests.md

This file was deleted.

4 changes: 3 additions & 1 deletion docs/src/contributing/debugging-in-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ npm run start:web

This opens Visual Studio Code running as a [web extension host][exthost] in Chromium. The language server runs as a [web worker][worker], and is started when you open a Sass file.

Open the Sass project you're using to test in the extension host window. If you don't have one you can open the folder `vscode-extension/test/fixtures/` in this repository.
Open the Sass project you're using to test in the extension host window.
If you don't have one you can find several `workspace/`
directories inside `vscode-extension/test/e2e/` in this repository.

## Navigating the Chromium developer tools

Expand Down
25 changes: 25 additions & 0 deletions docs/src/contributing/debugging-performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Debugging performance

Commonly refered to as performance profiling, this document explains how to run a performance test on Some Sass in Visual Studio Code.

## Performance Profiling in Visual Studio Code

To start a performance profile, first [launch the Some Sass extension](./debugging.md) from the Run and Debug pane in Visual Studio Code, then open a file with Sass code. Your debugging pane should look something like the image below.

![](../images/debugging/debugging.png)

The Call stack section lists Launch extension, which has four list items. The fourth list item, `node-server.js`, is the Some Sass language server. This is the program we want to profile.

If you've ever done [performance profiling of JavaScript](https://code.visualstudio.com/docs/nodejs/profiling) in VS Code before, profiling Some Sass works the same way.

Click or hover over the `node-server.js` row to show additional controls.

![](../images/debugging/debugging-profiling-controls.png)

Once the row is active you should see a list of icon buttons. The one we're interested in is the [circle with a dot in the center](https://code.visualstudio.com/docs/nodejs/profiling#_using-the-record-button), Take Performance Profile. Click it, and choose the [type of profile you want](https://code.visualstudio.com/docs/nodejs/profiling#_types-of-profiles). Unless you have specific plans, choose to stop the profile manually when asked.

Do the operations you want to measure (hover, go to definition, edit some code, or what have you). Then, go back to the debugger and click the button again to stop the performance profiling.

## Analyzing a performance profile

You can open the recorded performance profile in Visual Studio Code and dig into the numbers. The VS Code documentation has some tips on [how to analyze a profile](https://code.visualstudio.com/docs/nodejs/profiling#_analyzing-a-profile).
4 changes: 3 additions & 1 deletion docs/src/contributing/debugging-unit-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

This document assumes you use Visual Studio Code and have the [Vitest](https://marketplace.visualstudio.com/items?itemName=vitest.explorer) extension.

Open a unit test file (excluding tests in `vscode-css-languageservice`, which use Mocha) and find the test you want to debug.
Open a unit test file and find the test you want to debug.

You should see an icon in the gutter. To debug the test, right click and select Debug test.

![](../images/debugging/debug-individual-test.gif)

If you don't see any icons in the gutter it may be because the Vitest extension expects a different version of the `vitest` module. Try updating `vitest` in the repo and the Vitest extension, then restart VS Code.

## Test-driven development

When you work on a language feature it's useful to set up a test and use that while developing.
Expand Down
12 changes: 8 additions & 4 deletions docs/src/contributing/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ This page assumes you're using Visual Studio Code as the debugger. Go to the [Ru

- Launch extension
- Launch web extension
- Launch integration tests
- Launch web integration tests

## Launch extension

This opens a new window of Visual Studio Code running as a [local extension host][exthost]. Open the Sass project you're using to test in the extension host window. If you don't have one you can open the folder `vscode-extension/test/fixtures/` in this repository.
This opens a new window of Visual Studio Code running as a [local extension host][exthost].

Open the Sass project you're using to test in the extension host window.
If you don't have one you can find several `workspace/`
directories inside `vscode-extension/test/e2e/` in this repository.

### Set breakpoints

Expand All @@ -30,7 +32,9 @@ You'll find the log output in two places:

## Launch web extension

This opens a new window of Visual Studio Code running as a [web extension host][exthost]. Open the Sass project you're using to test in the extension host window. If you don't have one you can open the folder `vscode-extension/test/fixtures/` in this repository.
This opens a new window of Visual Studio Code running as a [web extension host][exthost]. Open the Sass project you're using to test in the extension host window.
If you don't have one you can find several `workspace/`
directories inside `vscode-extension/test/e2e/` in this repository.

Find `browser-server.js` in the `vscode-extension/dist/` folder to set breakpoints.

Expand Down
Loading