Skip to content

Commit 6522dd1

Browse files
committed
Update to version 1.23.6
2 parents 99447f5 + 73f4de7 commit 6522dd1

File tree

4 files changed

+35
-24
lines changed

4 files changed

+35
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@
1010
* Renaming symbol fails within a file that had recently been renamed without saving changes.
1111
* As a workaround, make an edit within the file before using Rename Symbol.
1212

13-
## 1.23.5 (Not yet released)
13+
## 1.23.6 (Not yet released)
14+
* Do not call updateBuffer if there are no changes. (PR: [#4170](https://github.com/OmniSharp/omnisharp-vscode/pull/4170))
15+
* Only skip file changed events when document is open. (PR: [#4178](https://github.com/OmniSharp/omnisharp-vscode/pull/4178))
16+
17+
## 1.23.5 (November 3, 2020)
1418
* Set meaning of UseGlobalMono "auto" to "never" since Mono 6.12.0 still ships with MSBuild 16.7 (PR: [#4130](https://github.com/OmniSharp/omnisharp-vscode/pull/4130))
1519
* Ensure that the rename identifier and run code action providers do not apply changes twice (PR: [#4133](https://github.com/OmniSharp/omnisharp-vscode/pull/4133))
1620
* Do not send file changed events for .cs files (PR: [#4141](https://github.com/OmniSharp/omnisharp-vscode/pull/4141), [#4143](https://github.com/OmniSharp/omnisharp-vscode/pull/4143))
1721
* Update Razor to 6.0.0-alpha.1.20529.17:
1822
* Improvements to HTML colorization for non-C# portions of the document.
1923
* Bug fix - the `razor.format.enable` option is honored again
2024

21-
## 1.23.4 (October, 19, 2020)
25+
## 1.23.4 (October 19, 2020)
2226
* Use incremental changes to update language server (PR: [#4088](https://github.com/OmniSharp/omnisharp-vscode/pull/4088))
2327
* Set meaning of UseGlobalMono "auto" to "always" now that Mono 6.12.0 ships with MSBuild 16.8 (PR: [#4115](https://github.com/OmniSharp/omnisharp-vscode/pull/4115))
2428
* Updated OmniSharp to 1.37.3

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "csharp",
33
"publisher": "muhammad-sammy",
4-
"version": "1.23.5",
5-
"description": "C# support for vscode-compatible editors (powered by OmniSharp).",
4+
"version": "1.23.6",
5+
"description": "C# support for vscode-compatible editors (powered by OmniSharp and NetCoreDbg).",
66
"displayName": "C#",
7-
"author": "Microsoft Corporation",
7+
"author": "Muhammad Sammy",
88
"license": "SEE LICENSE IN RuntimeLicenses/license.txt",
99
"icon": "images/csharpIcon.png",
1010
"preview": false,

src/features/changeForwarding.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,21 @@ function forwardDocumentChanges(server: OmniSharpServer): IDisposable {
1414

1515
return workspace.onDidChangeTextDocument(event => {
1616

17-
let { document } = event;
17+
let { document, contentChanges } = event;
1818
if (document.isUntitled || document.languageId !== 'csharp' || document.uri.scheme !== 'file') {
1919
return;
2020
}
2121

22+
if (contentChanges.length === 0) {
23+
// This callback fires with no changes when a document's state changes between "clean" and "dirty".
24+
return;
25+
}
26+
2227
if (!server.isRunning()) {
2328
return;
2429
}
2530

26-
const lineChanges = event.contentChanges.map(function (change): LinePositionSpanTextChange {
31+
const lineChanges = contentChanges.map(function (change): LinePositionSpanTextChange {
2732
const range = change.range;
2833
return {
2934
NewText: change.text,
@@ -49,21 +54,23 @@ function forwardFileChanges(server: OmniSharpServer): IDisposable {
4954
return;
5055
}
5156

52-
const docs = workspace.textDocuments.filter(doc => doc.uri.fsPath === uri.fsPath);
53-
if (Array.isArray(docs) && docs.some(doc => !doc.isClosed)) {
54-
// When a file changes on disk a FileSystemEvent is generated as well as a
55-
// DidChangeTextDocumentEvent.The ordering of these is:
56-
// 1. This method is called back. vscode's TextDocument has not yet been reloaded, so it has
57-
// the version from before the changes are applied.
58-
// 2. vscode reloads the file, and fires onDidChangeTextDocument. The document has been updated,
59-
// and the changes have the delta.
60-
// If we send this change to the server, then it will reload from the disk, which means it will
61-
// be synchronized to the version after the changes. Then, onDidChangeTextDocument will fire and
62-
// send the delta changes, which will cause the server to apply those exact changes. The results
63-
// being that the file is now in an inconsistent state.
64-
// If the document is closed, however, it will no longer be synchronized, so the text change will
65-
// not be triggered and we should tell the server to reread from the disk.
66-
return;
57+
if (changeType === FileChangeType.Change) {
58+
const docs = workspace.textDocuments.filter(doc => doc.uri.fsPath === uri.fsPath);
59+
if (Array.isArray(docs) && docs.some(doc => !doc.isClosed)) {
60+
// When a file changes on disk a FileSystemEvent is generated as well as a
61+
// DidChangeTextDocumentEvent.The ordering of these is:
62+
// 1. This method is called back. vscode's TextDocument has not yet been reloaded, so it has
63+
// the version from before the changes are applied.
64+
// 2. vscode reloads the file, and fires onDidChangeTextDocument. The document has been updated,
65+
// and the changes have the delta.
66+
// If we send this change to the server, then it will reload from the disk, which means it will
67+
// be synchronized to the version after the changes. Then, onDidChangeTextDocument will fire and
68+
// send the delta changes, which will cause the server to apply those exact changes. The results
69+
// being that the file is now in an inconsistent state.
70+
// If the document is closed, however, it will no longer be synchronized, so the text change will
71+
// not be triggered and we should tell the server to reread from the disk.
72+
return;
73+
}
6774
}
6875

6976
const req = { FileName: uri.fsPath, changeType };

0 commit comments

Comments
 (0)