Skip to content

Commit

Permalink
add caseSensitiveFileSupport (#9809)
Browse files Browse the repository at this point in the history
* add caseSensitiveFileSupport
  • Loading branch information
browntarik authored Sep 7, 2022
1 parent 38ed24f commit 2be467e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
10 changes: 10 additions & 0 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2662,6 +2662,16 @@
"markdownDescription": "%c_cpp.configuration.suggestSnippets.markdownDescription%",
"scope": "resource"
},
"C_Cpp.caseSensitiveFileSupport": {
"type": "string",
"enum": [
"default",
"enabled"
],
"default": "default",
"markdownDescription": "%c_cpp.configuration.caseSensitiveFileSupport.markdownDescription%",
"scope": "window"
},
"C_Cpp.enhancedColorization": {
"type": "string",
"enum": [
Expand Down
1 change: 1 addition & 0 deletions Extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
"c_cpp.configuration.default.dotConfig.markdownDescription": { "message": "The value to use in a configuration if `dotConfig` is not specified, or the value to insert if `${default}` is present in `dotConfig`.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.experimentalFeatures.description": "Controls whether \"experimental\" features are usable.",
"c_cpp.configuration.suggestSnippets.markdownDescription": { "message": "If `true`, snippets are provided by the language server.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.caseSensitiveFileSupport.markdownDescription": { "message": "If set to `default`, the file system of the workspace is assumed to be case insensitive on Windows and case sensitive on macOS or Linux. If set to `enabled`, the file system of the workspace is assumed to be case sensitive on Windows.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.enhancedColorization.markdownDescription": { "message": "If enabled, code is colorized based on IntelliSense. This setting only applies if `#C_Cpp.intelliSenseEngine#` is set to `Default`.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.codeFolding.description": "If enabled, code folding ranges are provided by the language server.",
"c_cpp.configuration.vcpkg.enabled.markdownDescription": { "message": "Enable integration services for the [vcpkg dependency manager](https://aka.ms/vcpkg/).", "comment": [ "Markdown text between () should not be altered: https://en.wikipedia.org/wiki/Markdown" ] },
Expand Down
26 changes: 21 additions & 5 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import * as util from '../common';
import * as configs from './configurations';
import { CppSettings, getEditorConfigSettings, OtherSettings } from './settings';
import * as telemetry from '../telemetry';
import { PersistentState, PersistentFolderState } from './persistentState';
import { PersistentState, PersistentFolderState, PersistentWorkspaceState } from './persistentState';
import { UI, getUI } from './ui';
import { ClientCollection } from './clientCollection';
import { createProtocolFilter } from './protocolFilter';
Expand All @@ -47,8 +47,10 @@ import * as os from 'os';
import * as refs from './references';
import * as nls from 'vscode-nls';
import { lookupString, localizedStringCount } from '../nativeStrings';
import { CodeAnalysisDiagnosticIdentifiersAndUri, RegisterCodeAnalysisNotifications, removeAllCodeAnalysisProblems,
removeCodeAnalysisProblems, RemoveCodeAnalysisProblemsParams } from './codeAnalysis';
import {
CodeAnalysisDiagnosticIdentifiersAndUri, RegisterCodeAnalysisNotifications, removeAllCodeAnalysisProblems,
removeCodeAnalysisProblems, RemoveCodeAnalysisProblemsParams
} from './codeAnalysis';
import { DebugProtocolParams, getDiagnosticsChannel, getOutputChannelLogger, logDebugProtocol, Logger, logLocalized, showWarning, ShowWarningParams } from '../logger';

nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
Expand Down Expand Up @@ -407,7 +409,6 @@ export interface GenerateDoxygenCommentParams {
isCodeAction: boolean;
isCursorAboveSignatureLine: boolean;
}

export interface GenerateDoxygenCommentResult {
contents: string;
initPosition: Position;
Expand Down Expand Up @@ -947,6 +948,8 @@ export class DefaultClient implements Client {
}

private createLanguageClient(allClients: ClientCollection): LanguageClient {
const currentCaseSensitiveFileSupport: PersistentWorkspaceState<boolean> = new PersistentWorkspaceState<boolean>("CPP.currentCaseSensitiveFileSupport", false);
let resetDatabase: boolean = false;
const serverModule: string = getLanguageServerFileName();
const exeExists: boolean = fs.existsSync(serverModule);
if (!exeExists) {
Expand Down Expand Up @@ -1201,6 +1204,11 @@ export class DefaultClient implements Client {
localizedStrings.push(lookupString(i));
}

if (workspaceSettings.caseSensitiveFileSupport !== currentCaseSensitiveFileSupport.Value) {
resetDatabase = true;
currentCaseSensitiveFileSupport.Value = workspaceSettings.caseSensitiveFileSupport;
}

const clientOptions: LanguageClientOptions = {
documentSelector: [
{ scheme: 'file', language: 'c' },
Expand All @@ -1209,8 +1217,10 @@ export class DefaultClient implements Client {
],
initializationOptions: {
freeMemory: os.freemem() / 1048576,
resetDatabase: resetDatabase,
maxConcurrentThreads: workspaceSettings.maxConcurrentThreads,
maxCachedProcesses: workspaceSettings.maxCachedProcesses,
caseSensitiveFileSupport: workspaceSettings.caseSensitiveFileSupport,
maxMemory: workspaceSettings.maxMemory,
intelliSense: {
maxCachedProcesses: workspaceSettings.intelliSenseMaxCachedProcesses,
Expand Down Expand Up @@ -1566,6 +1576,11 @@ export class DefaultClient implements Client {
if (changedSettings["legacyCompilerArgsBehavior"]) {
this.configuration.handleConfigurationChange();
}

if (changedSettings["caseSensitiveFileSupport"] && util.isWindows()) {
util.promptForReloadWindowDueToSettingsChange();
}

// if addNodeAddonIncludePaths was turned on but no includes have been found yet then 1) presume that nan
// or node-addon-api was installed so prompt for reload.
if (changedSettings["addNodeAddonIncludePaths"] && settings.addNodeAddonIncludePaths && this.configuration.nodeAddonIncludesFound() === 0) {
Expand Down Expand Up @@ -3189,7 +3204,8 @@ export class DefaultClient implements Client {
if (removeCodeAnalysisProblems(identifiersAndUris)) {
// Need to notify the language client of the removed diagnostics so it doesn't re-send them.
this.languageClient.sendNotification(RemoveCodeAnalysisProblemsNotification, {
identifiersAndUris: identifiersAndUrisCopy, refreshSquigglesOnSave: refreshSquigglesOnSave });
identifiersAndUris: identifiersAndUrisCopy, refreshSquigglesOnSave: refreshSquigglesOnSave
});
}
}

Expand Down
9 changes: 6 additions & 3 deletions Extension/src/LanguageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import * as vscode from 'vscode';
import { CommentPattern } from './languageConfig';
import { getExtensionFilePath, getCachedClangFormatPath, setCachedClangFormatPath, getCachedClangTidyPath, setCachedClangTidyPath } from '../common';
import { getExtensionFilePath, getCachedClangFormatPath, setCachedClangFormatPath, getCachedClangTidyPath, setCachedClangTidyPath, isWindows } from '../common';
import * as os from 'os';
import * as which from 'which';
import { execSync } from 'child_process';
Expand Down Expand Up @@ -162,7 +162,8 @@ export class CppSettings extends Settings {
return path;
}

public get maxConcurrentThreads(): number | undefined | null { return super.Section.get<number | null>("maxConcurrentThreads"); } public get maxMemory(): number | undefined | null { return super.Section.get<number | null>("maxMemory"); }
public get maxConcurrentThreads(): number | undefined | null { return super.Section.get<number | null>("maxConcurrentThreads"); }
public get maxMemory(): number | undefined | null { return super.Section.get<number | null>("maxMemory"); }
public get maxCachedProcesses(): number | undefined | null { return super.Section.get<number | null>("maxCachedProcesses"); }
public get intelliSenseMaxCachedProcesses(): number | undefined | null { return super.Section.get<number | null>("intelliSense.maxCachedProcesses"); }
public get intelliSenseMaxMemory(): number | undefined | null { return super.Section.get<number | null>("intelliSense.maxMemory"); }
Expand Down Expand Up @@ -253,7 +254,9 @@ export class CppSettings extends Settings {
public get defaultCustomConfigurationVariables(): { [key: string]: string } | undefined { return super.Section.get<{ [key: string]: string }>("default.customConfigurationVariables"); }
public get useBacktickCommandSubstitution(): boolean | undefined { return super.Section.get<boolean>("debugger.useBacktickCommandSubstitution"); }
public get codeFolding(): boolean { return super.Section.get<string>("codeFolding") === "Enabled"; }
public get legacyCompilerArgsBehavior(): boolean | undefined { return super.Section.get<boolean>("legacyCompilerArgsBehavior"); }
public get caseSensitiveFileSupport(): boolean { return !isWindows() || super.Section.get<string>("caseSensitiveFileSupport") === "enabled" ; }

public get legacyCompilerArgsBehavior(): boolean | undefined { return super.Section.get<boolean>("legacyCompilerArgsBehavior"); }

public get inlayHintsAutoDeclarationTypes(): boolean {
return super.Section.get<boolean>("inlayHints.autoDeclarationTypes.enabled") === true;
Expand Down

0 comments on commit 2be467e

Please sign in to comment.