Skip to content

Commit ba88be0

Browse files
authored
Implement intellisense for os161 source code (#17)
* Add clangd to extensions * Add intellisense to os161 source code * Change working directory of vscode build tasks * Add devcontainer config to .gitignore
1 parent 6c327ae commit ba88be0

4 files changed

Lines changed: 27 additions & 21 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ FROM base AS dev
4747
ENV DEBIAN_FRONTEND=noninteractive
4848
RUN apt-get update && apt-get -y install \
4949
bash-completion \
50+
bear \
51+
clangd \
5052
git \
5153
nodejs \
5254
openssh-client \

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"bierner.markdown-preview-github-styles",
2323
"christian-kohler.path-intellisense",
2424
"eamodio.gitlens",
25+
"llvm-vs-code-extensions.vscode-clangd",
2526
"ms-azuretools.vscode-docker",
2627
"ms-vscode.cpptools",
2728
"ms-vscode.live-server",

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# Ignore OS161 source
22
os161/
33
!os161/root/sys161.conf
4+
5+
# Clangd
6+
.cache/
7+
compile_commands.json
8+
9+
# Devcontainer config
10+
.devcontainer/config
11+
!.devcontainer/config/README
12+
!.devcontainer/config/.gdbinit

os161.code-workspace

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@
4343
"[c]": {
4444
"editor.rulers": [80],
4545
},
46-
46+
47+
// Disable C/C++ extension intellisense so clangd intellisense works
48+
"C_Cpp.intelliSenseEngine": "disabled",
49+
50+
// Clangd configuration
51+
"clangd.path": "/usr/bin/clangd",
52+
"clangd.arguments": [
53+
"--pretty",
54+
"--compile-commands-dir=${env:WORKSPACE_DIR}"
55+
]
4756
},
4857

4958
// Launch configuration
@@ -173,51 +182,36 @@
173182
"label": "Build",
174183
"detail": "Does a full build of OS161. Mapped to CTRL + SHIFT + B.",
175184
"type": "shell",
176-
"command": "./build.sh -p ${env:WORKSPACE_DIR}/os161/root -k ${input:kernel}",
177-
"options": {
178-
"cwd": "${env:WORKSPACE_DIR}/scripts"
179-
},
185+
"command": "bear -- bash scripts/build.sh -p ${env:WORKSPACE_DIR}/os161/root -k ${input:kernel}",
180186
"problemMatcher": [],
181187
"group": "build"
182188
},
183189
{
184190
"label": "Clean Build",
185191
"detail": "Restore the source tree to a pristine state and remove all generated files",
186192
"type": "shell",
187-
"command": "./clean_build.sh",
188-
"options": {
189-
"cwd": "${env:WORKSPACE_DIR}/scripts"
190-
},
193+
"command": "bash scripts/clean_build.sh",
191194
"problemMatcher": []
192195
},
193196
{
194197
"label": "Configure OS Tree",
195198
"detail": "Configures the OS tree with the provided path",
196199
"type": "shell",
197-
"command": "./configure_os_tree.sh -p ${env:WORKSPACE_DIR}/os161/root",
198-
"options": {
199-
"cwd": "${env:WORKSPACE_DIR}/scripts/build_helpers",
200-
},
200+
"command": "bash scripts/build_helpers/configure_os_tree.sh -p ${env:WORKSPACE_DIR}/os161/root",
201201
"problemMatcher": [],
202202
},
203203
{
204204
"label": "Compile Userland",
205205
"detail": "Compiles userland in src/",
206-
"command": "./compile_userland.sh",
206+
"command": "bash scripts/build_helpers/compile_userland.sh",
207207
"type": "shell",
208-
"options": {
209-
"cwd": "${env:WORKSPACE_DIR}/scripts/build_helpers",
210-
},
211208
"problemMatcher": [],
212209
},
213210
{
214211
"label": "Configure and Compile Kernel",
215212
"detail": "Configure and compile a specified kernel",
216-
"command": "./configure_and_compile_kernel.sh -k ${input:kernel}",
213+
"command": "bash scripts/build_helpers/configure_and_compile_kernel.sh -k ${input:kernel}",
217214
"type": "shell",
218-
"options": {
219-
"cwd": "${env:WORKSPACE_DIR}/scripts/build_helpers",
220-
},
221215
"problemMatcher": []
222216
},
223217
],

0 commit comments

Comments
 (0)