File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ implementation (#4414).
3838 vscode-remote-resource endpoint still can.
3939- OpenVSX has been made the default marketplace. However this means web
4040 extensions like Vim may be broken.
41+ - The last opened folder/workspace is no longer stored separately in the
42+ settings file (we rely on the already-existing query object instead).
4143
4244### Deprecated
4345
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { WebsocketRequest } from "../../../typings/pluginapi"
44import { logError } from "../../common/util"
55import { isDevMode } from "../constants"
66import { toVsCodeArgs } from "../cli"
7+ import { settings } from "../settings"
78import { ensureAuthenticated , authenticated , redirect } from "../http"
89import { loadAMDModule , readCompilationStats } from "../util"
910import { Router as WsRouter } from "../wsRouter"
@@ -31,6 +32,30 @@ export class CodeServerRouteWrapper {
3132 } )
3233 }
3334
35+ // Ew means the workspace was closed so clear the last folder/workspace.
36+ const { query } = await settings . read ( )
37+ if ( req . query . ew ) {
38+ delete query . folder
39+ delete query . workspace
40+ }
41+
42+ // Redirect to the last folder/workspace if nothing else is opened.
43+ if (
44+ ! req . query . folder &&
45+ ! req . query . workspace &&
46+ ( query . folder || query . workspace ) &&
47+ ! req . args [ "ignore-last-opened" ] // This flag disables this behavior.
48+ ) {
49+ return redirect ( req , res , "" , {
50+ folder : query . folder ,
51+ workspace : query . workspace ,
52+ } )
53+ }
54+
55+ // Store the query parameters so we can use them on the next load. This
56+ // also allows users to create functionality around query parameters.
57+ settings . write ( { query : req . query } )
58+
3459 next ( )
3560 }
3661
You can’t perform that action at this time.
0 commit comments