You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Example/README.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
# Example (Cursor/VSCode)
2
2
3
-
This is a simple **iOS** app that lets you see sourcekit-bazel-bsp in action. This example and instructions were designed specifically for **Cursor**, but should also work for VSCode.
3
+
This is a simple collection of iOS/watchOS/macOS apps that lets you see sourcekit-bazel-bsp in action. This example and instructions were designed specifically for **Cursor**, but should also work for VSCode.
4
4
5
5
## Initial Setup Instructions
6
6
7
7
- Make sure you fulfill the toolchain requirements for sourcekit-bazel-bsp, available at the main README.
8
-
- Install [bazelisk](https://github.com/bazelbuild/bazelisk) if you haven't already.
9
-
- On macOS: `brew install bazelisk`
8
+
- Install [bazelisk](https://github.com/bazelbuild/bazelisk) if you haven't already: `brew install bazelisk`
10
9
- Make sure you're using **Xcode 26** as this is what this project was developed with.
10
+
- Install [fzf](https://github.com/junegunn/fzf) if you haven't already: `brew install fzf`
11
+
- This is used to power the simulator selection features.
11
12
- On this folder, run:
12
13
-`bazelisk run //HelloWorld:setup_sourcekit_bsp_example_project`
13
14
- (Optional) Follow the instructions from the main README regarding configuring a custom SourceKit-LSP binary.
@@ -17,12 +18,12 @@ This is a simple **iOS** app that lets you see sourcekit-bazel-bsp in action. Th
17
18
18
19
After performing these steps, you should already be able to see the basic indexing features in action. It may take a minute or two the first time, but you can see the progress at the bottom of the IDE. You should also be able to see a new `SourceKit Language Server` option on the `Output` tab that shows sourcekit-lsp's internal logs, and after modifying a file for the first time an additional `SourceKit-LSP: Indexing` tab will pop up containing more detailed logs from both tools.
19
20
20
-
## Building and Testing
21
+
## Building and Debugging
21
22
22
-
- To run a regular build: Cmd+Shift+B -> `Build HelloWorld`
23
-
- To run a debug build, launch the simulator and attach `lldb`: Cmd+Shift+D -> `Debug HelloWorld (Example)`
24
-
-This requires a **iOS 18.6 iPhone 16 Pro**simulator installed as this is what the example project is currently configured for. Make sure you have one available, as otherwise the build will fail.
25
-
- To test: Cmd+Shift+P -> `Run Test Task` -> `Test HelloWorldTests`
23
+
- To build the example iOS app: `Terminal` -> `Run Build Task...` -> `Build HelloWorld`
24
+
- To run a debug build, launch a simulator and attach `lldb`:
25
+
-First, select an appropriate iOS simulator via `Terminal` -> `Run Task...` -> `Select Simulator for Apple Development`. The minimum OS version of the example app is **iOS 17.0**.
26
+
- Then: Cmd+Shift+D -> `Debug HelloWorld (Example)`. After building, the IDE will automatically launch your selected simulator and attach it to the IDE's lldb extension.
emit_launcher_error "No simulator selected! You need to first run the 'Select Simulator for Apple Development' task before being able to run this script."
20
+
fi
8
21
9
22
# When asking Bazel to launch a simulator, we need to intercept
10
23
# the launched process' PID to be able to debug it later on.
Copy file name to clipboardExpand all lines: README.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
-[x] All of the usual indexing features such as code completion, jump to definition, error annotations and so on, for both Swift and Obj-C (via the official [sourcekit-lsp](https://github.com/swiftlang/sourcekit-lsp))
13
13
-[x] (Cursor / VSCode): Building and launching, all from within the IDE and directly via Bazel (no project generation required!)
14
14
-[x] (Cursor / VSCode): Full `lldb` integration, allowing debugging from within the IDE just like Xcode (via [lldb-dap](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.lldb-dap), automatically provided by the official Swift extension)
15
-
-[] (Cursor / VSCode): Simulator selection from within the IDE
15
+
-[x] (Cursor / VSCode): Simulator selection from within the IDE (via custom IDE tasks)
16
16
-[ ] (Cursor / VSCode): Automatic generation of build, launch, and debug tasks
17
17
-[ ] (Cursor / VSCode): Test explorer & ability to run tests from within the IDE by clicking the tests individually, similarly to Xcode
18
18
-[ ] Automatic index and build graph updates when adding / deleting files and targets (in other words, allowing the user to make heavy changes to the project without needing to restart the IDE)
@@ -76,6 +76,12 @@ The BSP by default works by attempting to build your library targets individuall
76
76
77
77
If this is undesirable, you can pass the `--compile-top-level` flag to make the BSP compile the target's **parent** instead, without any special flags. We recommend using this for projects that define fine-grained `*_build_test` targets and providing them as top-level targets for the BSP, as those don't suffer from this issue and thus enables maximum predictability and cacheability.
78
78
79
+
## Best Practices
80
+
81
+
- When working with large apps, consider being more explicit about the task you're going to do. This means that instead of importing the _entire app at all times_, try to import only a small group of test targets that you think will be required to perform the task. This will greatly increase the performance of the IDE.
82
+
- For smaller apps, this doesn't make much difference and it should be fine to import the entire app.
83
+
- Similarly, avoid wide-reaching wildcards like `//...`. Do so only at a smaller scale to avoid too many targets from being picked up.
0 commit comments