Skip to content

Commit

Permalink
Switch to using an IsMiscellaneous propert on ProjectContext
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Oct 8, 2024
1 parent 8bea090 commit 5190dc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
8 changes: 3 additions & 5 deletions src/lsptoolshost/languageStatusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { languageServerOptions } from '../shared/options';
import { ServerState } from './serverStateChange';
import { getCSharpDevKit } from '../utils/getCSharpDevKit';
import { RazorLanguage } from '../razor/src/razorLanguage';
import { VSWorkspaceKind } from './roslynProtocol';

let currentServerState: ServerState = ServerState.Stopped;

Expand Down Expand Up @@ -87,10 +86,9 @@ class ProjectContextStatus {
// Show a warning when the active file is part of the Miscellaneous File workspace and
// project initialization is complete.
if (currentServerState === ServerState.ProjectInitializationComplete) {
item.severity =
e.context._vs_workspace_kind === VSWorkspaceKind.MiscellaneousFiles
? vscode.LanguageStatusSeverity.Warning
: vscode.LanguageStatusSeverity.Information;
item.severity = e.context._vs_is_miscellaneous
? vscode.LanguageStatusSeverity.Warning
: vscode.LanguageStatusSeverity.Information;
} else {
item.severity = vscode.LanguageStatusSeverity.Information;
}
Expand Down
8 changes: 1 addition & 7 deletions src/lsptoolshost/roslynProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ export interface VSProjectContextList {
_vs_defaultIndex: number;
}

export enum VSWorkspaceKind {
Unknown = 0,
Host = 1,
MiscellaneousFiles = 2,
}

export interface VSProjectContext {
_vs_label: string;
_vs_id: string;
_vs_kind: string;
_vs_workspace_kind: VSWorkspaceKind;
_vs_is_miscellaneous: boolean;
}

export interface VSTextDocumentIdentifier extends lsp.TextDocumentIdentifier {
Expand Down
9 changes: 2 additions & 7 deletions src/lsptoolshost/services/projectContextService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@

import * as vscode from 'vscode';
import { RoslynLanguageServer } from '../roslynLanguageServer';
import {
VSGetProjectContextsRequest,
VSProjectContext,
VSProjectContextList,
VSWorkspaceKind,
} from '../roslynProtocol';
import { VSGetProjectContextsRequest, VSProjectContext, VSProjectContextList } from '../roslynProtocol';
import { TextDocumentIdentifier } from 'vscode-languageserver-protocol';
import { UriConverter } from '../uriConverter';
import { LanguageServerEvents } from '../languageServerEvents';
Expand All @@ -31,7 +26,7 @@ export class ProjectContextService {
_vs_id: '',
_vs_kind: '',
_vs_label: '',
_vs_workspace_kind: VSWorkspaceKind.Unknown,
_vs_is_miscellaneous: false,
};

constructor(private _languageServer: RoslynLanguageServer, _languageServerEvents: LanguageServerEvents) {
Expand Down

0 comments on commit 5190dc4

Please sign in to comment.