Skip to content

Commit 2c2a649

Browse files
committed
Parse config file in entry
This way setting --data-dir and --extension-dir in the config file will work for --install--extension and whatnot.
1 parent 7ab47b3 commit 2c2a649

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/node/entry.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ try {
3131
const version = pkg.version || "development"
3232
const commit = pkg.commit || "development"
3333

34-
const main = async (cliArgs: Args): Promise<void> => {
35-
const configArgs = await readConfigFile(cliArgs.config)
36-
// This prioritizes the flags set in args over the ones in the config file.
37-
let args = Object.assign(configArgs, cliArgs)
38-
34+
const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void> => {
3935
if (!args.auth) {
4036
args = {
4137
...args,
@@ -145,18 +141,21 @@ function trimLDLibraryPath(): void {
145141
async function entry(): Promise<void> {
146142
trimLDLibraryPath()
147143

148-
const tryParse = async (): Promise<Args> => {
144+
const tryParse = async (): Promise<[Args, Args, Args]> => {
149145
try {
150-
let args = parse(process.argv.slice(2))
146+
const cliArgs = parse(process.argv.slice(2))
147+
const configArgs = await readConfigFile(cliArgs.config)
148+
// This prioritizes the flags set in args over the ones in the config file.
149+
let args = Object.assign(configArgs, cliArgs)
151150
args = await setDefaults(args)
152-
return args
151+
return [args, cliArgs, configArgs]
153152
} catch (error) {
154153
console.error(error.message)
155154
process.exit(1)
156155
}
157156
}
158157

159-
const args = await tryParse()
158+
const [args, cliArgs, configArgs] = await tryParse()
160159
if (args.help) {
161160
console.log("code-server", version, commit)
162161
console.log("")
@@ -200,7 +199,7 @@ async function entry(): Promise<void> {
200199
})
201200
vscode.on("exit", (code) => process.exit(code || 0))
202201
} else {
203-
wrap(() => main(args))
202+
wrap(() => main(args, cliArgs, configArgs))
204203
}
205204
}
206205

0 commit comments

Comments
 (0)