Skip to content

Commit 48d27c8

Browse files
committed
pass formatting settings into OmniSharp as CMD params
1 parent 6cac275 commit 48d27c8

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

src/omnisharp/launcher.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -161,26 +161,25 @@ function launch(cwd: string, args: string[]): Promise<LaunchResult> {
161161
return PlatformInformation.GetCurrent().then(platformInfo => {
162162
const options = Options.Read();
163163

164-
let envVars = {};
165164
if (options.useEditorFormattingSettings)
166165
{
167166
let editorConfig = vscode.workspace.getConfiguration('editor');
168-
envVars['formattingOptions:useTabs'] = !editorConfig.get('insertSpaces', true);
169-
envVars['formattingOptions:tabSize'] = editorConfig.get('tabSize', 4);
170-
envVars['formattingOptions:indentationSize'] = editorConfig.get('tabSize', 4);
167+
args.push(`formattingOptions:useTabs=${!editorConfig.get('insertSpaces', true)}`);
168+
args.push(`formattingOptions:tabSize=${editorConfig.get('tabSize', 4)}`);
169+
args.push(`formattingOptions:indentationSize=${editorConfig.get('tabSize',4)}`);
171170
}
172171

173172
if (options.path && options.useMono) {
174-
return launchNixMono(options.path, cwd, args, envVars);
173+
return launchNixMono(options.path, cwd, args);
175174
}
176175

177176
const launchPath = options.path || getLaunchPath(platformInfo);
178177

179178
if (platformInfo.isWindows()) {
180-
return launchWindows(launchPath, cwd, args, envVars);
179+
return launchWindows(launchPath, cwd, args);
181180
}
182181
else {
183-
return launchNix(launchPath, cwd, args, envVars);
182+
return launchNix(launchPath, cwd, args);
184183
}
185184
});
186185
}
@@ -193,7 +192,7 @@ function getLaunchPath(platformInfo: PlatformInformation): string {
193192
: path.join(binPath, 'run');
194193
}
195194

196-
function launchWindows(launchPath: string, cwd: string, args: string[], envVars: any): LaunchResult {
195+
function launchWindows(launchPath: string, cwd: string, args: string[]): LaunchResult {
197196
function escapeIfNeeded(arg: string) {
198197
const hasSpaceWithoutQuotes = /^[^"].* .*[^"]/;
199198
return hasSpaceWithoutQuotes.test(arg)
@@ -202,7 +201,6 @@ function launchWindows(launchPath: string, cwd: string, args: string[], envVars:
202201
}
203202

204203
let argsCopy = args.slice(0); // create copy of args
205-
//argsCopy.push('--debug');
206204
argsCopy.unshift(launchPath);
207205
argsCopy = [[
208206
'/s',
@@ -213,8 +211,7 @@ function launchWindows(launchPath: string, cwd: string, args: string[], envVars:
213211
let process = spawn('cmd', argsCopy, <any>{
214212
windowsVerbatimArguments: true,
215213
detached: false,
216-
cwd: cwd,
217-
env: envVars
214+
cwd: cwd
218215
});
219216

220217
return {
@@ -224,11 +221,10 @@ function launchWindows(launchPath: string, cwd: string, args: string[], envVars:
224221
};
225222
}
226223

227-
function launchNix(launchPath: string, cwd: string, args: string[], envVars: any): LaunchResult {
224+
function launchNix(launchPath: string, cwd: string, args: string[]): LaunchResult {
228225
let process = spawn(launchPath, args, {
229226
detached: false,
230-
cwd: cwd,
231-
env: envVars
227+
cwd: cwd
232228
});
233229

234230
return {
@@ -238,16 +234,15 @@ function launchNix(launchPath: string, cwd: string, args: string[], envVars: any
238234
};
239235
}
240236

241-
function launchNixMono(launchPath: string, cwd: string, args: string[], envVars: any): Promise<LaunchResult> {
237+
function launchNixMono(launchPath: string, cwd: string, args: string[]): Promise<LaunchResult> {
242238
return canLaunchMono()
243239
.then(() => {
244240
let argsCopy = args.slice(0); // create copy of details args
245241
argsCopy.unshift(launchPath);
246242

247243
let process = spawn('mono', argsCopy, {
248244
detached: false,
249-
cwd: cwd,
250-
env: envVars
245+
cwd: cwd
251246
});
252247

253248
return {

0 commit comments

Comments
 (0)