Skip to content

Commit 9ee9a3e

Browse files
committed
fix config get
1 parent ed6d677 commit 9ee9a3e

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

src/configRenames.ts

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function get<T>(
3131
defaultValue?: T
3232
): T | undefined {
3333
const oldKey = CONFIG_RENAMES.get(key);
34-
34+
3535
// Check if old config exists and has a non-null value
3636
if (oldKey && config.has(oldKey)) {
3737
const oldValue = config.get<T>(oldKey);
@@ -44,7 +44,7 @@ export function get<T>(
4444
return oldValue;
4545
}
4646
}
47-
47+
4848
// Get from new config key
4949
return config.get<T>(key, defaultValue as T);
5050
}
@@ -54,7 +54,7 @@ export function get<T>(
5454
*/
5555
function showDeprecationWarning(oldKey: string, newKey: string): void {
5656
const message = `Configuration "${oldKey}" is deprecated. Please use "${newKey}" instead.`;
57-
57+
5858
vscode.window.showWarningMessage(
5959
message,
6060
'Update Now',
@@ -71,73 +71,60 @@ function showDeprecationWarning(oldKey: string, newKey: string): void {
7171
*/
7272
export class ConfigurationManager {
7373
private readonly config: vscode.WorkspaceConfiguration;
74-
74+
7575
constructor(scope?: vscode.ConfigurationScope) {
7676
this.config = vscode.workspace.getConfiguration('emmylua', scope);
7777
}
78-
78+
7979
/**
8080
* Get a configuration value with type safety
8181
*/
8282
get<T>(section: string, defaultValue?: T): T | undefined {
83-
return get<T>(this.config, `emmylua.${section}`, defaultValue);
84-
}
85-
86-
/**
87-
* Check if a configuration affects language server behavior
88-
*/
89-
isLanguageServerConfig(section: string): boolean {
90-
const lsConfigPrefixes = [
91-
'emmylua.ls.',
92-
'emmylua.misc.executablePath',
93-
'emmylua.misc.globalConfigPath',
94-
];
95-
96-
return lsConfigPrefixes.some(prefix => section.startsWith(prefix));
83+
return get<T>(this.config, `${section}`, defaultValue) || get<T>(this.config, `emmylua.${section}`, defaultValue);
9784
}
98-
85+
9986
/**
10087
* Get language server executable path
10188
*/
10289
getExecutablePath(): string | undefined {
10390
return this.get<string>('misc.executablePath');
10491
}
105-
92+
10693
/**
10794
* Get language server global config path
10895
*/
10996
getGlobalConfigPath(): string | undefined {
11097
return this.get<string>('misc.globalConfigPath');
11198
}
112-
99+
113100
/**
114101
* Get language server start parameters
115102
*/
116103
getStartParameters(): string[] {
117104
return this.get<string[]>('ls.startParameters', []) || [];
118105
}
119-
106+
120107
/**
121108
* Get language server debug port
122109
*/
123110
getDebugPort(): number | null {
124111
return this.get<number | null>('ls.debugPort', null) || null;
125112
}
126-
113+
127114
/**
128115
* Get color configuration
129116
*/
130117
getColor(colorType: string): string | undefined {
131118
return this.get<string>(`colors.${colorType}`);
132119
}
133-
120+
134121
/**
135122
* Check if mutable variables should have underline
136123
*/
137124
useMutableUnderline(): boolean {
138125
return this.get<boolean>('colors.mutableUnderline', false) || false;
139126
}
140-
127+
141128
/**
142129
* Check if auto-complete annotation is enabled
143130
*/

0 commit comments

Comments
 (0)