File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ implementation (#4414).
38
38
vscode-remote-resource endpoint still can.
39
39
- OpenVSX has been made the default marketplace. However this means web
40
40
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).
41
43
42
44
### Deprecated
43
45
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { WebsocketRequest } from "../../../typings/pluginapi"
4
4
import { logError } from "../../common/util"
5
5
import { isDevMode } from "../constants"
6
6
import { toVsCodeArgs } from "../cli"
7
+ import { settings } from "../settings"
7
8
import { ensureAuthenticated , authenticated , redirect } from "../http"
8
9
import { loadAMDModule , readCompilationStats } from "../util"
9
10
import { Router as WsRouter } from "../wsRouter"
@@ -31,6 +32,32 @@ export class CodeServerRouteWrapper {
31
32
} )
32
33
}
33
34
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 ( {
58
+ query : req . query ,
59
+ } )
60
+
34
61
next ( )
35
62
}
36
63
You can’t perform that action at this time.
0 commit comments