mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Switches all samples to use eslint 9 with flat configs. I've tried to migrate existing settings as much as possible. However our eslint configs were also inconsistent so I've tried to align these too
Configuration Sample Extension
This sample shows
- How to define a
window,resourceandlanguage-overridablescoped configurations. - How to read and update a
windowscoped configuration - How to read a
resourcescoped configuration of a resource - How to update a value for
resourcescoped configuration of a resource - How to read a
language-overridablescoped configuration - How to override a
language-overridablescoped configuration under a language - How to listen to configuration changes
- How to test it
See extension.ts
Testing
Empty Workspace
Explains how to test this extension in an Empty workspace
Testing Window configuration
- Open User Settings and set
"conf.view.showOnWindowOpen": "scm" - Refresh the Window. SCM view will be shown always, even if you refresh from a view other than SCM.
- Run the command
Configure view to show on window openand Select the value (View to show when opening a window) - Value should be updated in
User Settings
Testing Resource configuration
- Open User Settings and set
"conf.resource.insertEmptyLastLine": {"${absolute_path_to_file}": true} - Open the above configured file in the empty window. A message about adding empty line from the extension is shown.
- Open a different file. No message is shown.
- Run the command
Configure empty last line for current file - Value in User settings is updated. Message is shown now
- Run the command
Configure empty last line for filesand provide absolute path of another file - Value should be updated in User Settings
Testing Language Specific configuration
- Set
"conf.language.showSize": truein user settings - Open a file and you should see the size of the file in the status
- Unset
conf.language.showSize - Run the command
Configuration Sample: Configure show size for language - Enter the language for which you want to configure this feature and press Enter.
- Open a file with above configured language and size of the file is shown in status
- Open a file with a different language and no status is shown.
Folder Workspace
Explains how to test this extension in a Folder workspace
Testing Window configuration
- Open User or Workspace Settings and set
"conf.view.showOnWindowOpen": "scm" - Refresh the Window. SCM view will be shown always, even if you refresh from a view other than SCM.
- Run the command
Configure view to show on window open. Select the value (View to show when opening a window) - Pick the target
User SettingsorWorkspace Settingsinto which the value should be updated - Value should be updated in selected target
Testing Resource configuration
- Open User Settings and set
"conf.resource.insertEmptyLastLine": {"${absolute_path_to_file}": true} - Open the above configured file in the empty window. A message about adding empty line from the extension is shown.
- Open a different file from the opened folder. No message is shown.
- Run the command
Configure empty last line for current file - Value in Workspace settings is updated. Message is shown now.
- Run the command
Configure empty last line for filesand provide absolute path of another file. - Pick the target
User SettingsorWorkspace Settingsinto which the value should be updated - Value should be updated in selected target
Testing Language Specific configuration
- Set
"conf.language.showSize": truein any settings (user, workspace) - Open a file and you should see the size of the file in the status
- Unset
conf.language.showSize - Run the command
Configuration Sample: Configure show size for language - Enter the language for which you want to configure this feature and press Enter.
- Open a file with above configured language and size of the file is shown in status
- Open a file with a different language and no status is shown.
Multiroot Workspace
Explains how to test this extension in a Multiroot workspace
Testing Window configuration
- Open User or Workspace Settings and set
"conf.view.showOnWindowOpen": "scm" - Refresh the Window. SCM view will be shown always, even if you refresh from a view other than SCM.
- NOTE: This setting cannot be applied under Folder settings, doing so will show a warning and value is not respected.
- Run the command
Configure view to show on window open. Select the value (View to show when opening a window) - Pick the target
User SettingsorWorkspace Settingsinto which the value should be updated - Value should be updated in selected target
Testing Resource configuration
- Open User Settings and set
"conf.resource.insertEmptyLastLine": {"${absolute_path_to_file}": true} - Open the above configured file in the empty window. A message about adding empty line from the extension is shown.
- Open a different file from one of the root folders. No message is shown.
- Run the command
Configure empty last line for current file - Value in Folder Settings of the root folder of the current file is updated. Message is shown now.
- Run the command
Configure empty last line for filesand provide absolute path of another file. - Pick the target
User SettingsorWorkspace SettingsorWorkspace Folder Settingsinto which the value should be updated - Selecting User or Workspace Settings should update the value in respective targets.
- Selecting Workspace Folder Settings will show a Workspace Folder Picker
- Picking a workspace folder should update the value in the respective folder settings file.
Testing Language Specific configuration
- Set
"conf.language.showSize": truein any settings (user, workspace or workspace folder) - Open a file and you should see the size of the file in the status
- Unset
conf.language.showSize - Run the command
Configuration Sample: Configure show size for language - Enter the language for which you want to configure this feature and press Enter.
- Open a file with above configured language and size of the file is shown in status
- Open a file with a different language and no status is shown.