SolaWing / xcode-build-server

a build server protocol implementation for integrate xcode with sourcekit-lsp
MIT License
283 stars 16 forks source link

Find References and Jump to Definition #9

Closed MrStevns closed 2 years ago

MrStevns commented 2 years ago

Hi Thanks for making this :)

Is the BSP setup supposed to make those features work too? The basic LSP features like seeing variables definitions, documentation, code completion and the like works but I haven't been able to get "find references" and jump to definition to work. I get no results or no references found.

Are those features also supposed to work? if not, is it possible to make it work through BSP and what would it take? I have little knowledge about LSP and BSP but I am more than happy to help if it's possible.

If it helps... I am on mac os 12 and my editor is Sublime Text 4.

SolaWing commented 2 years ago

as sourcekit-lsp says:

SourceKit-LSP uses a global index called IndexStoreDB to provide features that cross file or module boundaries, such as jump-to-definition or find-references. To efficiently create an index of your source code we use a technique called "indexing while building". When the project is compiled for debugging using swift build, the compiler (swiftc or clang) automatically produces additional raw index data that is read by our indexer. Producing this information during compilation saves work and ensures that any time the project is built the index is updated and fully accurate.

to make cross file jump or references to work, we need to provide the same indexstoredb. and the only place for BSP to provide this information is in build_initialize. we need to extract the correct xcode indexstoredb path to build_initialize.

When I have time, I will further test to see if I can achieve this feature

MrStevns commented 2 years ago

Ah I see, well in that case.. it should be a question of extracting the indexStorePath from the .compile file right? it's provided via the index-store-path param or is there more to it?

I will investigate and try some things later today.

SolaWing commented 2 years ago

@MrStevns newest version will record indexStorePath and use it when build_initialize this should ok if you won't cross workspace. please see the changed readme

suckerSlayer commented 2 years ago

Recently I have been back on iOS development, and use XBS for a practical development. Since XBS can parse the Xcode building log and make the sourcekit-lsp support code completion, which is great but while the "go to reference" malfunction from time to time. After several days research the native "swift build and generate .build to" way, I found it only function well when I have to manually pass many paramaters like the reference paths for iOS sdk and modules generated in Xcode with CocoaPods, and I also have to copy the Index Data from the Xcode development folders to the .build folder, which drives me crazy. Until I check this and found this update, and it works perfectly and solve my pain point accurately, thanks.

suckerSlayer commented 2 years ago

Oh it's just short fot your xcode build server, I have tried since last year, as I say it's the most perfect solution for xcode project by now.

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年2月12日(星期六) 中午12:34 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [SolaWing/xcode-build-server] Find References and Jump to Definition (Issue #9)

@suckerSlayer glad to help you. I am curious what is XBS. before I make this solution, I didn't find any solution work with xcode.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>