Skip to content

Commit 2be467e

Browse files
authored
add caseSensitiveFileSupport (#9809)
* add caseSensitiveFileSupport
1 parent 38ed24f commit 2be467e

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

Extension/package.json

+10
Original file line numberDiff line numberDiff line change
@@ -2662,6 +2662,16 @@
26622662
"markdownDescription": "%c_cpp.configuration.suggestSnippets.markdownDescription%",
26632663
"scope": "resource"
26642664
},
2665+
"C_Cpp.caseSensitiveFileSupport": {
2666+
"type": "string",
2667+
"enum": [
2668+
"default",
2669+
"enabled"
2670+
],
2671+
"default": "default",
2672+
"markdownDescription": "%c_cpp.configuration.caseSensitiveFileSupport.markdownDescription%",
2673+
"scope": "window"
2674+
},
26652675
"C_Cpp.enhancedColorization": {
26662676
"type": "string",
26672677
"enum": [

Extension/package.nls.json

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
"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." ] },
227227
"c_cpp.configuration.experimentalFeatures.description": "Controls whether \"experimental\" features are usable.",
228228
"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." ] },
229+
"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." ] },
229230
"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." ] },
230231
"c_cpp.configuration.codeFolding.description": "If enabled, code folding ranges are provided by the language server.",
231232
"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" ] },

Extension/src/LanguageServer/client.ts

+21-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import * as util from '../common';
3232
import * as configs from './configurations';
3333
import { CppSettings, getEditorConfigSettings, OtherSettings } from './settings';
3434
import * as telemetry from '../telemetry';
35-
import { PersistentState, PersistentFolderState } from './persistentState';
35+
import { PersistentState, PersistentFolderState, PersistentWorkspaceState } from './persistentState';
3636
import { UI, getUI } from './ui';
3737
import { ClientCollection } from './clientCollection';
3838
import { createProtocolFilter } from './protocolFilter';
@@ -47,8 +47,10 @@ import * as os from 'os';
4747
import * as refs from './references';
4848
import * as nls from 'vscode-nls';
4949
import { lookupString, localizedStringCount } from '../nativeStrings';
50-
import { CodeAnalysisDiagnosticIdentifiersAndUri, RegisterCodeAnalysisNotifications, removeAllCodeAnalysisProblems,
51-
removeCodeAnalysisProblems, RemoveCodeAnalysisProblemsParams } from './codeAnalysis';
50+
import {
51+
CodeAnalysisDiagnosticIdentifiersAndUri, RegisterCodeAnalysisNotifications, removeAllCodeAnalysisProblems,
52+
removeCodeAnalysisProblems, RemoveCodeAnalysisProblemsParams
53+
} from './codeAnalysis';
5254
import { DebugProtocolParams, getDiagnosticsChannel, getOutputChannelLogger, logDebugProtocol, Logger, logLocalized, showWarning, ShowWarningParams } from '../logger';
5355

5456
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
@@ -407,7 +409,6 @@ export interface GenerateDoxygenCommentParams {
407409
isCodeAction: boolean;
408410
isCursorAboveSignatureLine: boolean;
409411
}
410-
411412
export interface GenerateDoxygenCommentResult {
412413
contents: string;
413414
initPosition: Position;
@@ -947,6 +948,8 @@ export class DefaultClient implements Client {
947948
}
948949

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

1207+
if (workspaceSettings.caseSensitiveFileSupport !== currentCaseSensitiveFileSupport.Value) {
1208+
resetDatabase = true;
1209+
currentCaseSensitiveFileSupport.Value = workspaceSettings.caseSensitiveFileSupport;
1210+
}
1211+
12041212
const clientOptions: LanguageClientOptions = {
12051213
documentSelector: [
12061214
{ scheme: 'file', language: 'c' },
@@ -1209,8 +1217,10 @@ export class DefaultClient implements Client {
12091217
],
12101218
initializationOptions: {
12111219
freeMemory: os.freemem() / 1048576,
1220+
resetDatabase: resetDatabase,
12121221
maxConcurrentThreads: workspaceSettings.maxConcurrentThreads,
12131222
maxCachedProcesses: workspaceSettings.maxCachedProcesses,
1223+
caseSensitiveFileSupport: workspaceSettings.caseSensitiveFileSupport,
12141224
maxMemory: workspaceSettings.maxMemory,
12151225
intelliSense: {
12161226
maxCachedProcesses: workspaceSettings.intelliSenseMaxCachedProcesses,
@@ -1566,6 +1576,11 @@ export class DefaultClient implements Client {
15661576
if (changedSettings["legacyCompilerArgsBehavior"]) {
15671577
this.configuration.handleConfigurationChange();
15681578
}
1579+
1580+
if (changedSettings["caseSensitiveFileSupport"] && util.isWindows()) {
1581+
util.promptForReloadWindowDueToSettingsChange();
1582+
}
1583+
15691584
// if addNodeAddonIncludePaths was turned on but no includes have been found yet then 1) presume that nan
15701585
// or node-addon-api was installed so prompt for reload.
15711586
if (changedSettings["addNodeAddonIncludePaths"] && settings.addNodeAddonIncludePaths && this.configuration.nodeAddonIncludesFound() === 0) {
@@ -3189,7 +3204,8 @@ export class DefaultClient implements Client {
31893204
if (removeCodeAnalysisProblems(identifiersAndUris)) {
31903205
// Need to notify the language client of the removed diagnostics so it doesn't re-send them.
31913206
this.languageClient.sendNotification(RemoveCodeAnalysisProblemsNotification, {
3192-
identifiersAndUris: identifiersAndUrisCopy, refreshSquigglesOnSave: refreshSquigglesOnSave });
3207+
identifiersAndUris: identifiersAndUrisCopy, refreshSquigglesOnSave: refreshSquigglesOnSave
3208+
});
31933209
}
31943210
}
31953211

Extension/src/LanguageServer/settings.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import * as vscode from 'vscode';
88
import { CommentPattern } from './languageConfig';
9-
import { getExtensionFilePath, getCachedClangFormatPath, setCachedClangFormatPath, getCachedClangTidyPath, setCachedClangTidyPath } from '../common';
9+
import { getExtensionFilePath, getCachedClangFormatPath, setCachedClangFormatPath, getCachedClangTidyPath, setCachedClangTidyPath, isWindows } from '../common';
1010
import * as os from 'os';
1111
import * as which from 'which';
1212
import { execSync } from 'child_process';
@@ -162,7 +162,8 @@ export class CppSettings extends Settings {
162162
return path;
163163
}
164164

165-
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"); }
165+
public get maxConcurrentThreads(): number | undefined | null { return super.Section.get<number | null>("maxConcurrentThreads"); }
166+
public get maxMemory(): number | undefined | null { return super.Section.get<number | null>("maxMemory"); }
166167
public get maxCachedProcesses(): number | undefined | null { return super.Section.get<number | null>("maxCachedProcesses"); }
167168
public get intelliSenseMaxCachedProcesses(): number | undefined | null { return super.Section.get<number | null>("intelliSense.maxCachedProcesses"); }
168169
public get intelliSenseMaxMemory(): number | undefined | null { return super.Section.get<number | null>("intelliSense.maxMemory"); }
@@ -253,7 +254,9 @@ export class CppSettings extends Settings {
253254
public get defaultCustomConfigurationVariables(): { [key: string]: string } | undefined { return super.Section.get<{ [key: string]: string }>("default.customConfigurationVariables"); }
254255
public get useBacktickCommandSubstitution(): boolean | undefined { return super.Section.get<boolean>("debugger.useBacktickCommandSubstitution"); }
255256
public get codeFolding(): boolean { return super.Section.get<string>("codeFolding") === "Enabled"; }
256-
public get legacyCompilerArgsBehavior(): boolean | undefined { return super.Section.get<boolean>("legacyCompilerArgsBehavior"); }
257+
public get caseSensitiveFileSupport(): boolean { return !isWindows() || super.Section.get<string>("caseSensitiveFileSupport") === "enabled" ; }
258+
259+
public get legacyCompilerArgsBehavior(): boolean | undefined { return super.Section.get<boolean>("legacyCompilerArgsBehavior"); }
257260

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

0 commit comments

Comments
 (0)