Skip to content

Commit 9e91fa2

Browse files
authored
Merge branch 'main' into update_changelog_in_snap
2 parents 18fc37b + 087aa4a commit 9e91fa2

File tree

5 files changed

+72
-15
lines changed

5 files changed

+72
-15
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,23 @@
44
- Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876)
55

66
# 2.54.x
7+
* Update Roslyn to 4.13.0-1.24525.2 (PR: [#7694](https://github.com/dotnet/vscode-csharp/pull/7694))
8+
* Fix error message spelling (PR: [#75601](https://github.com/dotnet/roslyn/pull/75601))
9+
* Improve diagnostic performance by re-using results if diagnostic data is the same (PR: [#75587](https://github.com/dotnet/roslyn/pull/75587))
10+
* Improve performance in checksum computation (PR: [#75479](https://github.com/dotnet/roslyn/pull/75479))
711
* Bumped xamlTools to 17.13.35422.31 (PR: [#7685](https://github.com/dotnet/vscode-csharp/pull/7685))
12+
* Update Razor to 9.0.0-preview.24524.4 (PR: [#7692](https://github.com/dotnet/vscode-csharp/pull/7692))
13+
* Roslyn Tokenizer (#11086) (PR: [#11086](https://github.com/dotnet/razor/pull/11086))
14+
* **Experimental feature**
15+
* Add flush method and make it implementation detail on how that happens (#11087) (PR: [#11087](https://github.com/dotnet/razor/pull/11087))
16+
* Do not extract component into code block (#11069) (PR: [#11069](https://github.com/dotnet/razor/pull/11069))
17+
* **New code action to handle extracting razor code into a new razor component**
18+
* Handle EditorRequired *Changed/*Expression parameters (#11043) (PR: [#11043](https://github.com/dotnet/razor/pull/11043))
19+
* Avoid ambiguous `object` reference in generic component recovery (#11053) (PR: [#11053](https://github.com/dotnet/razor/pull/11053))
20+
* Move culture info check (#11057) (PR: [#11057](https://github.com/dotnet/razor/pull/11057))
21+
* Report a better error for void components (#11041) (PR: [#11041](https://github.com/dotnet/razor/pull/11041))
22+
* Ensure model directives are mapped at runtime (#11007) (PR: [#11007](https://github.com/dotnet/razor/pull/11007))
23+
* Including @using for Out-of-Scope Razor Component References (#10651) (PR: [#10651](https://github.com/dotnet/razor/pull/10651))
824

925
# 2.53.x
1026
* Update Roslyn to 4.13.0-1.24518.1 (PR: [#7670](https://github.com/dotnet/vscode-csharp/pull/7670))

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
}
3838
},
3939
"defaults": {
40-
"roslyn": "4.13.0-1.24518.1",
40+
"roslyn": "4.13.0-1.24525.2",
4141
"omniSharp": "1.39.11",
42-
"razor": "9.0.0-preview.24516.1",
42+
"razor": "9.0.0-preview.24524.4",
4343
"razorOmnisharp": "7.0.0-preview.23363.1",
4444
"xamlTools": "17.13.35422.31"
4545
},

src/lsptoolshost/languageStatusBar.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ function combineDocumentSelectors(...selectors: vscode.DocumentSelector[]): vsco
2929

3030
class WorkspaceStatus {
3131
static createStatusItem(context: vscode.ExtensionContext, languageServerEvents: RoslynLanguageServerEvents) {
32-
const documentSelector = combineDocumentSelectors(
33-
languageServerOptions.documentSelector,
34-
RazorLanguage.documentSelector
35-
);
32+
const documentSelector = combineDocumentSelectors(languageServerOptions.documentSelector);
3633
const openSolutionCommand = {
3734
command: 'dotnet.openSolution',
3835
title: vscode.l10n.t('Open solution'),
@@ -79,9 +76,10 @@ class ProjectContextStatus {
7976
// Show a warning when the active file is part of the Miscellaneous File workspace and
8077
// project initialization is complete.
8178
if (languageServer.state === ServerState.ProjectInitializationComplete) {
82-
item.severity = e.context._vs_is_miscellaneous
83-
? vscode.LanguageStatusSeverity.Warning
84-
: vscode.LanguageStatusSeverity.Information;
79+
item.severity =
80+
e.context._vs_is_miscellaneous && e.isVerified
81+
? vscode.LanguageStatusSeverity.Warning
82+
: vscode.LanguageStatusSeverity.Information;
8583
} else {
8684
item.severity = vscode.LanguageStatusSeverity.Information;
8785
}

src/lsptoolshost/miscellaneousFileNotifier.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function registerMiscellaneousFileNotifier(
2121
// Only warn for C# miscellaneous files when the workspace is fully initialized.
2222
if (
2323
e.languageId !== 'csharp' ||
24+
!e.isVerified ||
2425
!e.context._vs_is_miscellaneous ||
2526
languageServer.state !== ServerState.ProjectInitializationComplete
2627
) {
@@ -39,10 +40,10 @@ export function registerMiscellaneousFileNotifier(
3940
const hash = createHash(e.uri.toString(/*skipEncoding:*/ true));
4041
if (NotifiedDocuments.has(hash)) {
4142
return;
42-
} else {
43-
NotifiedDocuments.add(hash);
4443
}
4544

45+
NotifiedDocuments.add(hash);
46+
4647
const message = vscode.l10n.t(
4748
'The active document is not part of the open workspace. Not all language features will be available.'
4849
);

src/lsptoolshost/services/projectContextService.ts

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ export interface ProjectContextChangeEvent {
1515
languageId: string;
1616
uri: vscode.Uri;
1717
context: VSProjectContext;
18+
isVerified: boolean;
1819
}
1920

21+
const VerificationDelay = 2 * 1000;
22+
23+
let _verifyTimeout: NodeJS.Timeout | undefined;
24+
let _documentUriToVerify: vscode.Uri | undefined;
25+
2026
export class ProjectContextService {
2127
private readonly _contextChangeEmitter = new vscode.EventEmitter<ProjectContextChangeEvent>();
2228
private _source = new vscode.CancellationTokenSource();
@@ -47,7 +53,7 @@ export class ProjectContextService {
4753
public async refresh() {
4854
const textEditor = vscode.window.activeTextEditor;
4955
const languageId = textEditor?.document?.languageId;
50-
if (languageId !== 'csharp' && languageId !== 'aspnetcorerazor') {
56+
if (languageId !== 'csharp') {
5157
return;
5258
}
5359

@@ -57,19 +63,55 @@ export class ProjectContextService {
5763

5864
const uri = textEditor!.document.uri;
5965

66+
// Whether we have refreshed the active document's project context.
67+
let isVerifyPass = false;
68+
69+
if (_verifyTimeout) {
70+
// If we have changed active document then do not verify the previous one.
71+
clearTimeout(_verifyTimeout);
72+
_verifyTimeout = undefined;
73+
}
74+
75+
if (_documentUriToVerify) {
76+
if (uri.toString() === _documentUriToVerify.toString()) {
77+
// We have rerequested project contexts for the active document
78+
// and we can now notify if the document isn't part of the workspace.
79+
isVerifyPass = true;
80+
}
81+
82+
_documentUriToVerify = undefined;
83+
}
84+
6085
if (!this._languageServer.isRunning()) {
61-
this._contextChangeEmitter.fire({ languageId, uri, context: this._emptyProjectContext });
86+
this._contextChangeEmitter.fire({ languageId, uri, context: this._emptyProjectContext, isVerified: false });
6287
return;
6388
}
6489

6590
const contextList = await this.getProjectContexts(uri, this._source.token);
6691
if (!contextList) {
67-
this._contextChangeEmitter.fire({ languageId, uri, context: this._emptyProjectContext });
92+
this._contextChangeEmitter.fire({ languageId, uri, context: this._emptyProjectContext, isVerified: false });
6893
return;
6994
}
7095

7196
const context = contextList._vs_projectContexts[contextList._vs_defaultIndex];
72-
this._contextChangeEmitter.fire({ languageId, uri, context });
97+
const isVerified = !context._vs_is_miscellaneous || isVerifyPass;
98+
this._contextChangeEmitter.fire({ languageId, uri, context, isVerified });
99+
100+
if (context._vs_is_miscellaneous && !isVerifyPass) {
101+
// Request the active project context be refreshed but delay the request to give
102+
// time for the project system to update with new files.
103+
_verifyTimeout = setTimeout(() => {
104+
_verifyTimeout = undefined;
105+
_documentUriToVerify = uri;
106+
107+
// Trigger a refresh, but don't block on refresh completing.
108+
this.refresh().catch((e) => {
109+
throw new Error(`Error refreshing project context status ${e}`);
110+
});
111+
}, VerificationDelay);
112+
113+
return;
114+
}
73115
}
74116

75117
private async getProjectContexts(

0 commit comments

Comments
 (0)