Skip to content

Commit 60e81fc

Browse files
authored
Merge pull request #205 from sourcery-ai/ben/sou-1699-feat-deploy-the-coding-assistant-application-in-vscode
feat: deploy the coding assistant application in vscode
2 parents bb43bf8 + 1ce9f7a commit 60e81fc

File tree

14 files changed

+3583
-2971
lines changed

14 files changed

+3583
-2971
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
# Except src and media:
55
!/src
66
!/media
7+
8+
# But do ignore resource webview assets
9+
/src/resources/webview/assets/*

media/ide-styles.css

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
:root {
2+
--background: var(--vscode-sideBar-background); /* main background */
3+
--foreground: var(--vscode-foreground); /* foreground text */
4+
--editor: var(--vscode-editor-background); /* editor background */
5+
--chat: var(
6+
--vscode-settings-textInputBackground
7+
); /* chat bubble background */
8+
--error: var(--vscode-inputValidation-errorBackground); /* error background */
9+
--disabled: var(--vscode-disabledForeground); /* disabled foreground */
10+
--border: var(--vscode-panel-border); /* border */
11+
--primary: var(--vscode-button-background);
12+
--highlight: orange;
13+
}
14+
15+
html {
16+
font-size: var(--vscode-font-size);
17+
}
18+
19+
body.vscode-light .hljs {
20+
color: #24292e;
21+
background: #fff;
22+
}
23+
body.vscode-light .hljs-doctag,
24+
body.vscode-light .hljs-keyword,
25+
body.vscode-light .hljs-meta body.vscode-light .hljs-keyword,
26+
body.vscode-light .hljs-template-tag,
27+
body.vscode-light .hljs-template-variable,
28+
body.vscode-light .hljs-type,
29+
body.vscode-light .hljs-variable.language_ {
30+
color: #d73a49;
31+
}
32+
body.vscode-light .hljs-title,
33+
body.vscode-light .hljs-title.class_,
34+
body.vscode-light .hljs-title.class_.inherited__,
35+
body.vscode-light .hljs-title.function_ {
36+
color: #6f42c1;
37+
}
38+
body.vscode-light .hljs-attr,
39+
body.vscode-light .hljs-attribute,
40+
body.vscode-light .hljs-literal,
41+
body.vscode-light .hljs-meta,
42+
body.vscode-light .hljs-number,
43+
body.vscode-light .hljs-operator,
44+
body.vscode-light .hljs-selector-attr,
45+
body.vscode-light .hljs-selector-class,
46+
body.vscode-light .hljs-selector-id,
47+
body.vscode-light .hljs-variable {
48+
color: #005cc5;
49+
}
50+
body.vscode-light .hljs-meta body.vscode-light .hljs-string,
51+
body.vscode-light .hljs-regexp,
52+
body.vscode-light .hljs-string {
53+
color: #032f62;
54+
}
55+
body.vscode-light .hljs-built_in,
56+
body.vscode-light .hljs-symbol {
57+
color: #e36209;
58+
}
59+
body.vscode-light .hljs-code,
60+
body.vscode-light .hljs-comment,
61+
body.vscode-light .hljs-formula {
62+
color: #6a737d;
63+
}
64+
body.vscode-light .hljs-name,
65+
body.vscode-light .hljs-quote,
66+
body.vscode-light .hljs-selector-pseudo,
67+
body.vscode-light .hljs-selector-tag {
68+
color: #22863a;
69+
}
70+
body.vscode-light .hljs-subst {
71+
color: #24292e;
72+
}
73+
body.vscode-light .hljs-section {
74+
color: #005cc5;
75+
font-weight: 700;
76+
}
77+
body.vscode-light .hljs-bullet {
78+
color: #735c0f;
79+
}
80+
body.vscode-light .hljs-emphasis {
81+
color: #24292e;
82+
font-style: italic;
83+
}
84+
body.vscode-light .hljs-strong {
85+
color: #24292e;
86+
font-weight: 700;
87+
}
88+
body.vscode-light .hljs-addition {
89+
color: #22863a;
90+
background-color: #f0fff4;
91+
}
92+
body.vscode-light .hljs-deletion {
93+
color: #b31d28;
94+
background-color: #ffeef0;
95+
}
96+
97+
body.vscode-dark .hljs {
98+
color: #c9d1d9;
99+
background: #0d1117;
100+
}
101+
body.vscode-dark .hljs-doctag,
102+
body.vscode-dark .hljs-keyword,
103+
body.vscode-dark .hljs-meta body.vscode-dark .hljs-keyword,
104+
body.vscode-dark .hljs-template-tag,
105+
body.vscode-dark .hljs-template-variable,
106+
body.vscode-dark .hljs-type,
107+
body.vscode-dark .hljs-variable.language_ {
108+
color: #ff7b72;
109+
}
110+
body.vscode-dark .hljs-title,
111+
body.vscode-dark .hljs-title.class_,
112+
body.vscode-dark .hljs-title.class_.inherited__,
113+
body.vscode-dark .hljs-title.function_ {
114+
color: #d2a8ff;
115+
}
116+
body.vscode-dark .hljs-attr,
117+
body.vscode-dark .hljs-attribute,
118+
body.vscode-dark .hljs-literal,
119+
body.vscode-dark .hljs-meta,
120+
body.vscode-dark .hljs-number,
121+
body.vscode-dark .hljs-operator,
122+
body.vscode-dark .hljs-selector-attr,
123+
body.vscode-dark .hljs-selector-class,
124+
body.vscode-dark .hljs-selector-id,
125+
body.vscode-dark .hljs-variable {
126+
color: #79c0ff;
127+
}
128+
body.vscode-dark .hljs-meta body.vscode-dark .hljs-string,
129+
body.vscode-dark .hljs-regexp,
130+
body.vscode-dark .hljs-string {
131+
color: #a5d6ff;
132+
}
133+
body.vscode-dark .hljs-built_in,
134+
body.vscode-dark .hljs-symbol {
135+
color: #ffa657;
136+
}
137+
body.vscode-dark .hljs-code,
138+
body.vscode-dark .hljs-comment,
139+
body.vscode-dark .hljs-formula {
140+
color: #8b949e;
141+
}
142+
body.vscode-dark .hljs-name,
143+
body.vscode-dark .hljs-quote,
144+
body.vscode-dark .hljs-selector-pseudo,
145+
body.vscode-dark .hljs-selector-tag {
146+
color: #7ee787;
147+
}
148+
body.vscode-dark .hljs-subst {
149+
color: #c9d1d9;
150+
}
151+
body.vscode-dark .hljs-section {
152+
color: #1f6feb;
153+
font-weight: 700;
154+
}
155+
body.vscode-dark .hljs-bullet {
156+
color: #f2cc60;
157+
}
158+
body.vscode-dark .hljs-emphasis {
159+
color: #c9d1d9;
160+
font-style: italic;
161+
}
162+
body.vscode-dark .hljs-strong {
163+
color: #c9d1d9;
164+
font-weight: 700;
165+
}
166+
body.vscode-dark .hljs-addition {
167+
color: #aff5b4;
168+
background-color: #033a16;
169+
}
170+
body.vscode-dark .hljs-deletion {
171+
color: #ffdcd7;
172+
background-color: #67060c;
173+
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,6 @@
7575
"contextualTitle": "Troubleshooting",
7676
"when": "sourcery.features.coding_assistant_troubleshooting"
7777
},
78-
{
79-
"id": "sourcery.recipes",
80-
"name": "Recipes",
81-
"type": "webview",
82-
"icon": "sourcery-icon.png",
83-
"contextualTitle": "Recipes",
84-
"when": "sourcery.features.coding_assistant"
85-
},
86-
{
87-
"id": "sourcery.code_review",
88-
"name": "Code Review",
89-
"type": "webview",
90-
"icon": "sourcery-icon.png",
91-
"contextualTitle": "Code Review",
92-
"when": "sourcery.features.code_review"
93-
},
9478
{
9579
"id": "sourcery.rules",
9680
"name": "Rules",
@@ -248,11 +232,6 @@
248232
"title": "Toggle Advanced Mode",
249233
"category": "Sourcery"
250234
},
251-
{
252-
"command": "sourcery.chat.clearChat",
253-
"title": "Clear",
254-
"category": "Sourcery"
255-
},
256235
{
257236
"command": "sourcery.chat.clearCodeReview",
258237
"title": "Clear",
@@ -316,16 +295,6 @@
316295
"when": "view == sourcery.rules",
317296
"group": "navigation"
318297
},
319-
{
320-
"command": "sourcery.chat.clearChat",
321-
"when": "view == sourcery.chat",
322-
"group": "navigation"
323-
},
324-
{
325-
"command": "sourcery.chat.clearCodeReview",
326-
"when": "view == sourcery.code_review",
327-
"group": "navigation"
328-
},
329298
{
330299
"command": "sourcery.troubleshoot.reset",
331300
"when": "view == sourcery.troubleshooting",
@@ -400,10 +369,6 @@
400369
"command": "sourcery.scan.toggleAdvanced",
401370
"when": "false"
402371
},
403-
{
404-
"command": "sourcery.chat.clearChat",
405-
"when": "false"
406-
},
407372
{
408373
"command": "sourcery.chat.clearCodeReview",
409374
"when": "false"
@@ -485,7 +450,7 @@
485450
"compile": "tsc -watch -p ./",
486451
"compile-webviews": "tsc -watch ./src/webview/*.ts",
487452
"vscode": "npm run vscode:prepublish && VSCODE=$(which code-insiders || which code || echo echo ERROR: neither the code nor code-insiders vscode executable is installed); USER=dummy-dont-share-vscode-instance \"$VSCODE\" --user-data-dir=$PWD/.vscode-dev/user-data --verbose --extensionHomePath=$PWD/.vscode-dev/extensions --extensionDevelopmentPath=$PWD $*",
488-
"vscode_local": "SOURCERY_EXECUTABLE=../core/run-sourcery.sh yarn run vscode",
453+
"vscode_local": "SOURCERY_EXECUTABLE=/home/ben/Documents/dev/sourcery-ai/core/run-sourcery.sh yarn run vscode",
489454
"format": "prettier --write .",
490455
"lint:format": "prettier --check .",
491456
"vscode:prepublish": "npm run esbuild-base -- --minify",

src/ask-sourcery.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import * as vscode from "vscode";
2-
import { Recipe, RecipeProvider } from "./recipes";
3-
import { ChatRequest } from "./chat";
2+
import { Recipe, ServerRequest } from "./chat";
43

54
export function askSourceryCommand(recipes: Recipe[], contextRange?) {
65
showAskSourceryQuickPick(recipes).then((result: any) => {
7-
let request: ChatRequest;
6+
let request: ServerRequest;
87
if ("id" in result) {
98
request = {
10-
type: "recipe_request",
9+
type: "recipeRequest",
1110
data: {
1211
kind: "recipe_request",
1312
name: result.label,
@@ -17,7 +16,7 @@ export function askSourceryCommand(recipes: Recipe[], contextRange?) {
1716
};
1817
} else {
1918
request = {
20-
type: "chat_request",
19+
type: "chatRequest",
2120
data: { kind: "user_message", message: result.label },
2221
context_range: contextRange,
2322
};

0 commit comments

Comments
 (0)