# VSCode: Bridging headers with Intellisense in simple Embedded Project

**URL:** <https://forums.swift.org/t/vscode-bridging-headers-with-intellisense-in-simple-embedded-project/78470>\
**Category:** Using Swift\
**Tags:** bridging, embedded, sourcekit-lsp, vscode, vscode-swift\
**Created:** [March 12, 2025, 8:08pm UTC](https://forums.swift.org/t/vscode-bridging-headers-with-intellisense-in-simple-embedded-project/78470 "2025-03-12T20:08:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bnbarham](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/bnbarham/32/17708_2.png) [@bnbarham](https://forums.swift.org/u/bnbarham)\
**Post date:** [March 13, 2025, 5:12am UTC](https://forums.swift.org/t/vscode-bridging-headers-with-intellisense-in-simple-embedded-project/78470/2 "2025-03-13T05:12:43Z")

</div>

The problem you're running into here is that with the current setup, sourcekit-lsp has no way to know what settings to use for a particular file (so eg. `main.swift` here).

sourcekit-lsp has a few ways to retrieve this information - either through SwiftPM, a [compilation databases](https://clang.llvm.org/docs/JSONCompilationDatabase.html), or a custom [BSP server](https://github.com/swiftlang/sourcekit-lsp/blob/main/Contributor%20Documentation/Implementing%20a%20BSP%20server.md#implementing-a-bsp-server).

The second is what you're looking for in this case.

Unfortunately, there's no simple way to produce [compile\_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html#format) with Make (with CMake you can set `CMAKE_EXPORT_COMPILE_COMMANDS`). You could probably get away with using [compile\_flags.txt](https://clang.llvm.org/docs/JSONCompilationDatabase.html#alternatives) today, but I would recommend just manually crafting `compile_commads.json` instead:

1. Remove `swift.sourcekit-lsp.serverArguments` from `.vscode/settings.json` - these are arguments to provide to the language server (sourcekit-lsp) on launch, not compilation arguments.
2. Remove `.sourcekit-lsp/config.json` - `swiftPM` is specifically for configuring SwiftPM projects further, which you don't have here.
3. Add a `compile_commands.json` next to your `makefile`:

```swift
[
  {
    "directory": "/[... REDACTED ...]/HelloWorld",
    "command": "swiftc source/main.swift -enable-experimental-feature Embedded -target armv7em-none-none-eabi -no-allocations -import-objc-header source/Bridging-Header.h -I /opt/devkitPro/DEVKITARM/include -I /opt/devkitPro/DEVKITARM/arm-none-eabi/include -I /opt/devkitPro/libctru/include",
    "file": "source/main.swift"
  }
]

```

1. Open the workspace in VS Code

---

_[View the full topic](https://forums.swift.org/t/vscode-bridging-headers-with-intellisense-in-simple-embedded-project/78470)._
