Skip to content

Commit 697d99f

Browse files
committed
fix(server): sourcekit panic from swift-frontend compiled command
1 parent 4071681 commit 697d99f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/compile.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ pub async fn generate_from_steps(steps: &Vec<Step>) -> Result<CompilationDatabas
6666

6767
while let Some(step) = steps.next() {
6868
if let Step::CompileSwiftSources(sources) = step {
69+
// HACK: Commands with files key break source kit
70+
// unknown argument: '-frontend'
71+
// unknown argument: '-primary-file'
72+
// unknown argument: '-primary-file'
73+
// unknown argument: '-primary-file'
74+
// unknown argument: '-emit-dependencies-path'
75+
// unknown argument: '-emit-reference-dependencies-path'
76+
// unknown argument: '-enable-objc-interop'
77+
// unknown argument: '-new-driver-path'
78+
// unknown argument: '-serialize-debugging-options'
79+
// unknown argument: '-enable-anonymous-context-mangled-names'
80+
// unknown argument: '-target-sdk-version'
81+
// option '-serialize-diagnostics-path' is not supported by 'swiftc'; did you mean to use 'swift'?
82+
if sources.command.contains("swift-frontend") {
83+
continue;
84+
}
85+
6986
let arguments = shell_words::split(&sources.command)?;
7087

7188
let file = Default::default();
@@ -74,6 +91,7 @@ pub async fn generate_from_steps(steps: &Vec<Step>) -> Result<CompilationDatabas
7491
let mut files = Vec::default();
7592
let mut file_lists = Vec::default();
7693
let mut index_store_path = None;
94+
7795
for i in 0..arguments.len() {
7896
let val = &arguments[i];
7997
if val == "-module-name" {
@@ -89,6 +107,7 @@ pub async fn generate_from_steps(steps: &Vec<Step>) -> Result<CompilationDatabas
89107
if let Some(ref index_store_path) = index_store_path {
90108
_index_store_path.push(index_store_path.clone());
91109
}
110+
92111
commands.push(CompilationCommand {
93112
name,
94113
file,

0 commit comments

Comments
 (0)