Skip to content

Commit aa44e6c

Browse files
committed
refactor: remove folder/workspace from vsCodeCliArgs
Since we handle this in the vscode.ts route, we no longer need to pass it to VS Code as a CLI arg since it's deprecated on that side.
1 parent 1465d8d commit aa44e6c

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

src/node/cli.ts

-16
Original file line numberDiff line numberDiff line change
@@ -751,25 +751,9 @@ export const shouldOpenInExistingInstance = async (args: UserProvidedArgs): Prom
751751
* Convert our arguments to VS Code server arguments.
752752
*/
753753
export const toVsCodeArgs = async (args: DefaultedArgs): Promise<CodeServerLib.ServerParsedArgs> => {
754-
let workspace = ""
755-
let folder = ""
756-
if (args._.length) {
757-
const lastEntry = path.resolve(args._[args._.length - 1])
758-
const entryIsFile = await isFile(lastEntry)
759-
if (entryIsFile && path.extname(lastEntry) === ".code-workspace") {
760-
workspace = lastEntry
761-
} else if (!entryIsFile) {
762-
folder = lastEntry
763-
}
764-
// Otherwise it is a regular file. Spawning VS Code with a file is not yet
765-
// supported but it can be done separately after code-server spawns.
766-
}
767-
768754
return {
769755
"connection-token": "0000",
770756
...args,
771-
workspace,
772-
folder,
773757
"accept-server-license-terms": true,
774758
/** Type casting. */
775759
help: !!args.help,

test/unit/node/cli.test.ts

-25
Original file line numberDiff line numberDiff line change
@@ -702,29 +702,6 @@ describe("toVsCodeArgs", () => {
702702
it("should convert empty args", async () => {
703703
expect(await toVsCodeArgs(await setDefaults(parse([])))).toStrictEqual({
704704
...vscodeDefaults,
705-
folder: "",
706-
workspace: "",
707-
})
708-
})
709-
710-
it("should convert with workspace", async () => {
711-
const workspace = path.join(await tmpdir(testName), "test.code-workspace")
712-
await fs.writeFile(workspace, "foobar")
713-
expect(await toVsCodeArgs(await setDefaults(parse([workspace])))).toStrictEqual({
714-
...vscodeDefaults,
715-
workspace,
716-
folder: "",
717-
_: [workspace],
718-
})
719-
})
720-
721-
it("should convert with folder", async () => {
722-
const folder = await tmpdir(testName)
723-
expect(await toVsCodeArgs(await setDefaults(parse([folder])))).toStrictEqual({
724-
...vscodeDefaults,
725-
folder,
726-
workspace: "",
727-
_: [folder],
728705
})
729706
})
730707

@@ -733,8 +710,6 @@ describe("toVsCodeArgs", () => {
733710
await fs.writeFile(file, "foobar")
734711
expect(await toVsCodeArgs(await setDefaults(parse([file])))).toStrictEqual({
735712
...vscodeDefaults,
736-
folder: "",
737-
workspace: "",
738713
_: [file],
739714
})
740715
})

0 commit comments

Comments
 (0)