Skip to content

Commit 6f8c2ea

Browse files
committed
temp
1 parent afabff7 commit 6f8c2ea

File tree

8 files changed

+329
-17
lines changed

8 files changed

+329
-17
lines changed

.vscode/launch.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,23 @@
1010
"type": "extensionHost",
1111
"request": "launch",
1212
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
13-
"outFiles": ["${workspaceFolder}/out/**/*.js"],
14-
"preLaunchTask": "Build"
13+
"outFiles": [
14+
// "${workspaceFolder:sa-vscode}/out/**/*.js",
15+
// "${workspaceFolder:source-lsp}/dist/**/*.js"
16+
"${workspaceFolder}/out/**/*.js"
17+
],
18+
"preLaunchTask": "Build",
19+
"autoAttachChildProcesses": true
20+
},
21+
{
22+
"type": "node",
23+
"request": "attach",
24+
"name": "Attach to Server 6009",
25+
"address": "localhost",
26+
"protocol": "inspector",
27+
"port": 6009,
28+
"sourceMaps": true,
29+
"outFiles": ["${workspaceRoot:source-lsp}/dist/**/*.js"]
1530
}
1631
]
1732
}

.vscode/tasks.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@
44
{
55
"label": "Build",
66
"type": "shell",
7-
"command": "yarn run build",
7+
"command": "yarn",
8+
"args": ["build"],
9+
"options": {
10+
"cwd": "${workspaceFolder}"
11+
},
812
"group": {
913
"kind": "build",
1014
"isDefault": true
1115
},
1216
"presentation": {
1317
"reveal": "never",
1418
"panel": "shared"
15-
}
19+
},
20+
"problemMatcher": []
1621
}
1722
]
1823
}

assets/sa.svg

Lines changed: 75 additions & 0 deletions
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"package": "Package the extension into .vsix format"
101101
},
102102
"scripts": {
103-
"build": "node scripts/build.js",
103+
"build": "echo $PWD && node scripts/build.js",
104104
"watch": "node ./esbuild.js --watch",
105105
"format": "yarn prettier . --write",
106106
"vscode:prepublish": "yarn run build",

src/extension.ts

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,35 @@ export function activate(context: vscode.ExtensionContext) {
1717
context.subscriptions.push(setupStatusBar(context));
1818

1919
activateLspClient(context);
20+
21+
// TODO: Split this handler into subhandlers, and them its own folder in src/uriHandlers
2022
vscode.window.registerUriHandler({
23+
// Use handleUri: (uri) => {},
2124
handleUri(uri: vscode.Uri) {
22-
const searchParams = new URLSearchParams(uri.query);
23-
const code = searchParams.get("code");
24-
vscode.window.showInformationMessage(`Code: ${code}`);
25-
const provider = searchParams.get("provider");
26-
vscode.window.showInformationMessage(`Provider: ${provider}`);
27-
28-
// context.globalState.update("token", {
29-
// accessToken: code,
30-
// refreshToken: provider,
31-
// });
32-
const url = `http://localhost:4000/v2/auth/exchange/?code=${code}&provider=${provider}`;
33-
showPanel(context, url);
25+
switch (uri.path) {
26+
case "/sso":
27+
{
28+
const searchParams = new URLSearchParams(uri.query);
29+
const code = searchParams.get("code");
30+
const provider = searchParams.get("provider");
31+
vscode.window.showInformationMessage("Authenticating...");
32+
const url = `http://localhost:4000/v2/auth/exchange/?code=${code}&provider=${provider}`;
33+
showPanel(context, url);
34+
}
35+
break;
36+
case "/sharelink":
37+
{
38+
const hash = uri.fragment;
39+
const url = `http://localhost:8000/playground${hash}`;
40+
showPanel(context, url);
41+
}
42+
break;
43+
default:
44+
vscode.window.showErrorMessage(
45+
`Unrecognized path in deeplink: ${uri.path}`,
46+
);
47+
return;
48+
}
3449
},
3550
});
3651
}

src/lsp/client.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ let client: LanguageClient;
1414
const SECTION = "\u00A7";
1515

1616
export function activateLspClient(context: ExtensionContext) {
17+
console.log("Activating Source Language Server...");
1718
// The server is implemented in node
1819
const serverModule = context.asAbsolutePath(
1920
path.join("out", "source-lsp.js"),
2021
);
22+
console.error("=======================");
23+
console.error(serverModule);
24+
25+
let debugOptions = { execArgv: ["--nolazy", "--inspect=6009"] };
2126

2227
// If the extension is launched in debug mode then the debug server options are used
2328
// Otherwise the run options are used
@@ -26,6 +31,7 @@ export function activateLspClient(context: ExtensionContext) {
2631
debug: {
2732
module: serverModule,
2833
transport: TransportKind.ipc,
34+
options: debugOptions,
2935
},
3036
};
3137

@@ -50,6 +56,7 @@ export function activateLspClient(context: ExtensionContext) {
5056

5157
// Start the client. This will also launch the server
5258
client.start();
59+
// client.sendNotification('trolling')
5360

5461
const version = `Source ${SECTION}4`;
5562

src/utils/messages.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const Messages = createMessages({
2222
workspaceLocation: VscWorkspaceLocation,
2323
assessmentName: string,
2424
questionId: number,
25+
chapter: number,
26+
prepend: string,
2527
code: string,
2628
) => ({
2729
workspaceLocation,

0 commit comments

Comments
 (0)