@@ -32,7 +32,7 @@ export namespace LSPServer {
3232 const excludedFiles = Filesystem . up ( {
3333 targets : excludePatterns ,
3434 start : path . dirname ( file ) ,
35- stop : Instance . directory ,
35+ stop : Instance . worktree ,
3636 } )
3737 const excluded = await excludedFiles . next ( )
3838 await excludedFiles . return ( )
@@ -41,7 +41,7 @@ export namespace LSPServer {
4141 const files = Filesystem . up ( {
4242 targets : includePatterns ,
4343 start : path . dirname ( file ) ,
44- stop : Instance . directory ,
44+ stop : Instance . worktree ,
4545 } )
4646 const first = await files . next ( )
4747 await files . return ( )
@@ -895,7 +895,14 @@ export namespace LSPServer {
895895 root : NearestRoot ( [ "compile_commands.json" , "compile_flags.txt" , ".clangd" , "CMakeLists.txt" , "Makefile" ] ) ,
896896 extensions : [ ".c" , ".cpp" , ".cc" , ".cxx" , ".c++" , ".h" , ".hpp" , ".hh" , ".hxx" , ".h++" ] ,
897897 async spawn ( root ) {
898- const args = [ "--background-index" , "--clang-tidy" ]
898+ const args = [
899+ "--background-index" ,
900+ "--clang-tidy" ,
901+ "--query-driver=**/clang++,**/clang,**/clang-cl,**/g++,**/gcc,**/ccache,**/sccache" ,
902+ ]
903+ if ( await pathExists ( path . join ( root , "compile_commands.json" ) ) ) {
904+ args . push ( `--compile-commands-dir=${ root } ` )
905+ }
899906 const fromPath = Bun . which ( "clangd" )
900907 if ( fromPath ) {
901908 return {
0 commit comments