Skip to content

Commit 29ca762

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 b018112 commit 29ca762

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
@@ -770,25 +770,9 @@ export const shouldOpenInExistingInstance = async (args: UserProvidedArgs): Prom
770770
* Convert our arguments to VS Code server arguments.
771771
*/
772772
export const toVsCodeArgs = async (args: DefaultedArgs): Promise<CodeServerLib.ServerParsedArgs> => {
773-
let workspace = ""
774-
let folder = ""
775-
if (args._.length) {
776-
const lastEntry = path.resolve(args._[args._.length - 1])
777-
const entryIsFile = await isFile(lastEntry)
778-
if (entryIsFile && path.extname(lastEntry) === ".code-workspace") {
779-
workspace = lastEntry
780-
} else if (!entryIsFile) {
781-
folder = lastEntry
782-
}
783-
// Otherwise it is a regular file. Spawning VS Code with a file is not yet
784-
// supported but it can be done separately after code-server spawns.
785-
}
786-
787773
return {
788774
"connection-token": "0000",
789775
...args,
790-
workspace,
791-
folder,
792776
"accept-server-license-terms": true,
793777
/** Type casting. */
794778
help: !!args.help,

test/unit/node/cli.test.ts

-25
Original file line numberDiff line numberDiff line change
@@ -726,29 +726,6 @@ describe("toVsCodeArgs", () => {
726726
it("should convert empty args", async () => {
727727
expect(await toVsCodeArgs(await setDefaults(parse([])))).toStrictEqual({
728728
...vscodeDefaults,
729-
folder: "",
730-
workspace: "",
731-
})
732-
})
733-
734-
it("should convert with workspace", async () => {
735-
const workspace = path.join(await tmpdir(testName), "test.code-workspace")
736-
await fs.writeFile(workspace, "foobar")
737-
expect(await toVsCodeArgs(await setDefaults(parse([workspace])))).toStrictEqual({
738-
...vscodeDefaults,
739-
workspace,
740-
folder: "",
741-
_: [workspace],
742-
})
743-
})
744-
745-
it("should convert with folder", async () => {
746-
const folder = await tmpdir(testName)
747-
expect(await toVsCodeArgs(await setDefaults(parse([folder])))).toStrictEqual({
748-
...vscodeDefaults,
749-
folder,
750-
workspace: "",
751-
_: [folder],
752729
})
753730
})
754731

@@ -757,8 +734,6 @@ describe("toVsCodeArgs", () => {
757734
await fs.writeFile(file, "foobar")
758735
expect(await toVsCodeArgs(await setDefaults(parse([file])))).toStrictEqual({
759736
...vscodeDefaults,
760-
folder: "",
761-
workspace: "",
762737
_: [file],
763738
})
764739
})

0 commit comments

Comments
 (0)