Repository: stylelint/vscode-stylelint (ts)

Issue:
[Bug]: File is not formatted on save
### How did you encounter this bug?

1. Save a file with fixable errors
2. Nothing happens

### Code Snippet

Basic example but it occurs with any fixable errors.

```css
.test {
	margin-bottom: 10rem /* <- `;` is missing */
}
```


### Extension Configuration

```js
module.exports = {
	parser: 'babel-eslint',
	extends: [
		"stylelint-config-standard",
		"stylelint-config-standard-scss",
	],
	ignoreFiles: ["**/*.js"],
	rules: {
		indentation: 'tab',
		'string-quotes': 'single',
		'length-zero-no-unit': null,
		'at-rule-no-unknown': null,
		'declaration-block-trailing-semicolon': 'always',
		'selector-pseudo-class-no-unknown': [true, {'ignorePseudoClasses': ['global']}],
		'no-descending-specificity': null,
		'selector-class-pattern': null,
		'comment-empty-line-before': null,
		'scss/double-slash-comment-empty-line-before': null,
		'scss/dollar-variable-empty-line-before': null,
		'alpha-value-notation': 'number',
		'color-function-notation': null
	}
}
```


### Actual Behaviour

Nothing happens.

### Expected Behaviour

It should format/fix the file.

Running _Format Document_ command doesn't format the document but _Stylelint: Fix all auto-fixable Problems_ works.

### Logs

<details><summary>Logs</summary>
<p>

```
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server] Linting document | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss" linterOptions: {}
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server] Could not find a Yarn lockfile | cwd: "/home/roch/workspace/sofinnova/web/src/components/search"
[Debug - 11:00:41 a.m.] [language-server] NODE_PATH value is: /home/roch/.nvm/versions/node/v16.13.0/lib/node_modules | verbose: undefined
[Debug - 11:00:41 a.m.] [language-server:code-action] Received onCodeAction | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss" context: {"diagnostics":[]}
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server:code-action] Creating code actions | only: undefined
[Debug - 11:00:41 a.m.] [language-server:code-action] Returning code actions | actions: []
[Debug - 11:00:41 a.m.] [language-server:code-action] Received onCodeAction | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss" context: {"diagnostics":[{"range":{"start":{"line":1,"character":19},"end":{"line":1,"character":20}},"message":"Expected a trailing semicolon (declaration-block-trailing-semicolon)","code":"declaration-block-trailing-semicolon","codeDescription":{"href":"https://stylelint.io/user-guide/rules/declaration-block-trailing-semicolon"},"severity":1,"source":"Stylelint"},{"range":{"start":{"line":1,"character":16},"end":{"line":1,"character":17}},"message":"Unexpected unknown unit \"re\" (unit-no-unknown)","code":"unit-no-unknown","codeDescription":{"href":"https://stylelint.io/user-guide/rules/unit-no-unknown"},"severity":1,"source":"Stylelint"}],"only":["source.fixAll.stylelint"]}
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server:code-action] Creating code actions | only: ["source.fixAll.stylelint"]
[Debug - 11:00:41 a.m.] [language-server:code-action] Creating "source-fix-all" code action
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server] Could not find a Yarn lockfile | cwd: "/home/roch/workspace/sofinnova/web/src/components/search"
[Debug - 11:00:41 a.m.] [language-server] NODE_PATH value is: /home/roch/.nvm/versions/node/v16.13.0/lib/node_modules | verbose: undefined
[Debug - 11:00:41 a.m.] [language-server] Resolved Stylelint from node_modules | path: "/home/roch/workspace/sofinnova/web/node_modules/stylelint/lib/index.js"
[Debug - 11:00:41 a.m.] [language-server] Running Stylelint | options: {"ignoreDisables":false,"reportNeedlessDisables":false,"reportInvalidScopeDisables":false,"ignorePath":"/home/roch/workspace/sofinnova/.stylelintignore","code":"...","codeFilename":"/home/roch/workspace/sofinnova/web/src/components/search/test.scss"}
[Debug - 11:00:41 a.m.] [language-server] Lint run complete | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss" results: {"diagnostics":[{"range":{"start":{"line":1,"character":20},"end":{"line":1,"character":21}},"message":"Expected a trailing semicolon (declaration-block-trailing-semicolon)","severity":1,"code":"declaration-block-trailing-semicolon","source":"Stylelint","codeDescription":{"href":"https://stylelint.io/user-guide/rules/declaration-block-trailing-semicolon"}}]}
[Debug - 11:00:41 a.m.] [language-server:validator] Sending diagnostics | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss" result: {"diagnostics":[{"range":{"start":{"line":1,"character":20},"end":{"line":1,"character":21}},"message":"Expected a trailing semicolon (declaration-block-trailing-semicolon)","severity":1,"code":"declaration-block-trailing-semicolon","source":"Stylelint","codeDescription":{"href":"https://stylelint.io/user-guide/rules/declaration-block-trailing-semicolon"}}]}
[Debug - 11:00:41 a.m.] [language-server:validator] Diagnostics sent | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server] Resolved Stylelint from node_modules | path: "/home/roch/workspace/sofinnova/web/node_modules/stylelint/lib/index.js"
[Debug - 11:00:41 a.m.] [language-server] Running Stylelint | options: {"fix":true,"ignoreDisables":false,"reportNeedlessDisables":false,"reportInvalidScopeDisables":false,"ignorePath":"/home/roch/workspace/sofinnova/.stylelintignore","code":"...","codeFilename":"/home/roch/workspace/sofinnova/web/src/components/search/test.scss"}
[Debug - 11:00:41 a.m.] [language-server] Fixes retrieved | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss" edits: [{"range":{"start":{"line":1,"character":21},"end":{"line":1,"character":21}},"newText":";"}]
[Debug - 11:00:41 a.m.] [language-server:code-action] Returning code actions | actions: [{"title":"Fix all Stylelint auto-fixable problems","edit":{"documentChanges":[{"textDocument":{"_uri":"file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss","_languageId":"scss","_version":38,"_content":".test {\n\tmargin-bottom: 10rem\n}\n","_lineOffsets":[0,8,30,32]},"edits":[{"range":{"start":{"line":1,"character":21},"end":{"line":1,"character":21}},"newText":";"}]}]},"kind":"source.fixAll.stylelint"}]
[Debug - 11:00:41 a.m.] [language-server:code-action] Received onCodeAction | uri: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss" context: {"diagnostics":[{"range":{"start":{"line":1,"character":20},"end":{"line":1,"character":21}},"message":"Expected a trailing semicolon (declaration-block-trailing-semicolon)","code":"declaration-block-trailing-semicolon","codeDescription":{"href":"https://stylelint.io/user-guide/rules/declaration-block-trailing-semicolon"},"severity":1,"source":"Stylelint"}]}
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server:code-action] Creating code actions | only: undefined
[Debug - 11:00:41 a.m.] [language-server] Returning cached options | resource: "file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss"
[Debug - 11:00:41 a.m.] [language-server:code-action] Creating disable rule for line code action | rule: "declaration-block-trailing-semicolon" location: "separateLine"
[Debug - 11:00:41 a.m.] [language-server:code-action] Creating disable rule for file code action | rule: "declaration-block-trailing-semicolon"
[Debug - 11:00:41 a.m.] [language-server:code-action] Creating documentation code action | rule: "declaration-block-trailing-semicolon"
[Debug - 11:00:41 a.m.] [language-server:code-action] Returning code actions | actions: [{"title":"Disable declaration-block-trailing-semicolon for this line","edit":{"documentChanges":[{"textDocument":{"uri":"file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss","version":38},"edits":[{"range":{"start":{"line":1,"character":0},"end":{"line":1,"character":0}},"newText":"\t/* stylelint-disable-next-line declaration-block-trailing-semicolon */\n"}]}]},"kind":"quickfix"},{"title":"Disable declaration-block-trailing-semicolon for the entire file","edit":{"documentChanges":[{"textDocument":{"uri":"file:///home/roch/workspace/sofinnova/web/src/components/search/test.scss","version":38},"edits":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"newText":"/* stylelint-disable declaration-block-trailing-semicolon */\n"}]}]},"kind":"quickfix"},{"title":"Show documentation for declaration-block-trailing-semicolon","command":{"title":"Open documentation for declaration-block-trailing-semicolon","command":"stylelint.openRuleDoc","arguments":[{"uri":"https://stylelint.io/user-guide/rules/declaration-block-trailing-semicolon"}]},"kind":"quickfix"}]
```

</p>
</details>

### Stylelint Version

14.1.0

### vscode-stylelint Version

1.2.0

### Node.js Version

16.13.0

### Operating System

Windows 10 21H1

### Windows Subsystem for Linux

WSL 2 Windows 10 21H1

### Code of Conduct

- [X] I agree to follow vscode-stylelint's Code of Conduct
[Bug]: Unknown workspace edit change received causing `source.fixAll.stylelint` to break
### How did you encounter this bug?

When a stylelint rule is triggered, it can be fixed by using "Stylelint: Fix all auto-fixable Problems", but doesn't fix on save as it should according to #35. I've also disabled all other extensions to make sure I am not having conflicts with Prettier or something like that. Ultimately, i'd like for both to work, but without prettier, it behaves the same way. 

Current settings:

.stylelintrc.json
```json
{
	"plugins": ["stylelint-order", "stylelint-scss"],
	"extends": "stylelint-config-prettier",
	"customSyntax": "postcss-scss",
	"rules": {
               ...
        }
{
```

### Code Snippet

Any stylelint warning/error. 

### Extension Configuration

```json
"css.validate": false,
"scss.validate": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
	"source.fixAll.stylelint": true
},
"stylelint.validate": ["css", "scss"],
"stylelint.snippet": ["css", "scss"],
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 3000,
```


### Actual Behaviour

When I save the document, none of the errors/warnings are fixed.

### Expected Behaviour

I expect the errors/warnings to fix on save. 

### Logs

The debug log doesn't show any issues, but the "log (window)" shows:

```
}: Error: Unknown workspace edit change received:
{    "textDocument": {
        "_uri": "file:///Users/nicoford/Documents/SEL/projects/sel.web.designsystem/packages/components/Button/Button.module.scss",
        "_languageId": "scss",
        "_version": 1,
        ... (content from document) ...
}
at Un (/Users/nicoford/.vscode/extensions/stylelint.vscode-stylelint-1.2.0/dist/index.js:33:52805)
at Object.Ar [as asCodeAction] (/Users/nicoford/.vscode/extensions/stylelint.vscode-stylelint-1.2.0/dist/index.js:33:51654)
at /Users/nicoford/.vscode/extensions/stylelint.vscode-stylelint-1.2.0/dist/index.js:34:33360
at async A.provideCodeActions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:94:172824)
```

### Stylelint Version

14.1.0

### vscode-stylelint Version

1.2.0

### Node.js Version

v16.13.0

### Operating System

macOS 11.5.1

### Windows Subsystem for Linux

NA

### Code of Conduct

- [X] I agree to follow vscode-stylelint's Code of Conduct

Pull request:
fix: code actions on save does not apply
<!-- Each pull request must be associated with an open issue unless it's a documentation fix. If a corresponding issue does not exist, please create one so we can discuss the change first. -->

<!-- Please answer the following. We close pull requests that don't. -->

> Which issue, if any, is this issue related to?

Closes #329
Closes #327

> Is there anything in the PR that needs further explanation?

No, it's self-explanatory.


Patch:
diff --git a/src/server/modules/code-action.ts b/src/server/modules/code-action.ts
index 8e59b37..8ee0290 100644
--- a/src/server/modules/code-action.ts
+++ b/src/server/modules/code-action.ts
@@ -126,10 +126,12 @@ export class CodeActionModule implements LanguageServerModule {
 	async #getAutoFixAllAction(document: TextDocument): Promise<LSP.CodeAction | undefined> {
 		const edits = await this.#context.getFixes(document);
 
+		const identifier = { uri: document.uri, version: document.version };
+
 		return edits.length > 0
 			? LSP.CodeAction.create(
 					'Fix all Stylelint auto-fixable problems',
-					{ documentChanges: [LSP.TextDocumentEdit.create(document, edits)] },
+					{ documentChanges: [LSP.TextDocumentEdit.create(identifier, edits)] },
 					StylelintCodeActionKind.StylelintSourceFixAll,
 			  )
 			: undefined;


Test patch:
diff --git a/src/server/modules/__tests__/__snapshots__/code-action.ts.snap b/src/server/modules/__tests__/__snapshots__/code-action.ts.snap
index 58c42fd..2ca34bc 100644
--- a/src/server/modules/__tests__/__snapshots__/code-action.ts.snap
+++ b/src/server/modules/__tests__/__snapshots__/code-action.ts.snap
@@ -58,13 +58,9 @@ Array [
               },
             },
           ],
-          "textDocument": FullTextDocument {
-            "_content": "line 1
-line 2",
-            "_languageId": "bar",
-            "_lineOffsets": undefined,
-            "_uri": "foo",
-            "_version": 1,
+          "textDocument": Object {
+            "uri": "foo",
+            "version": 1,
           },
         },
       ],
@@ -96,13 +92,9 @@ Array [
               },
             },
           ],
-          "textDocument": FullTextDocument {
-            "_content": "line 1
-line 2",
-            "_languageId": "bar",
-            "_lineOffsets": undefined,
-            "_uri": "foo",
-            "_version": 1,
+          "textDocument": Object {
+            "uri": "foo",
+            "version": 1,
           },
         },
       ],