Comments (10)
Is there any progress?
from bazel-compile-commands-extractor.
Hey, @yrom! Nope, since you're the first to express interest here. Let me check in on the Apple project.
Looks like the Apple project (linked above) is still listed as early development, but is also now bundled in Xcode and has a fairly popular, highly rated vscode extension. So maybe a good time to explore. And there's no harm to supporting it early.
I probably shouldn't just build this myself right now only because there's too much else going on. (Need to focus on the startup I'm running, and we don't currently use Swift.) But I'd be delighted to help if you'd be interested in adding this, especially since you just submitted a great pr :) I think integrating it into this tool would be be the way to go, much better and easier than doing separately.
A high level sketch of what I'd imagine could be a good way of doing it:
- First, it'd be valuable to check that the Apple project looks to be working well enough to integrate--and needs an integration. I'd probably spin up some quick tests:
i. First a non-bazel project using their vscode plugin and making sure that it was supplying decent autocomplete, etc.
ii. Then using their tool with an existing bazel workspace to check on its compile_commands.json loading, checking that there's a strong need to add compile_commands.json entries to get better autocomplete, and figuring out how to get their indexing during building to work with Bazel. - Assuming everything looks good, add the swift compile to our aquery mnemonics filter, separating out those commands so we don't try to pass them to clang to do header extraction, but directing them into compile_commands.json
- And finally, we'd add some docs so other people can figure out how to use it, too!
-CS
from bazel-compile-commands-extractor.
Hi, @cpsauer I have done some work to extend command-extractor for apple project based on Sourcekit-lsp. It works well on swift and objective-c project using swift plugin in vscode(conflicted with clangd plugin). But the approach needs create and run a bsp(Build server protocol) server to provider compile commands to it. Do you think it should be just another fork for apple or a pull request to the command extractor?
from bazel-compile-commands-extractor.
Thanks for chiming in :) I think we should collaborate to merge it if we can! Much better to have a cross platform tool.
But I'd like to understand a little bit more.
Some questions:
- How well does sourcekit-lsp work? Do things work well, like clangd?
- Could you tell me more about this BSP server? Can sourcekit-lsp not just take in a compile_commands.json? (I thought I saw code snippets indicating yes, but I could be wrong.)
Thanks!
Chris
from bazel-compile-commands-extractor.
Hi Chris,
How well does sourcekit-lsp work? Do things work well, like clangd?
- Since sourcekit-lsp is top of clangd it is exactly the same experience under objc and c (there isn't much cpp code in our project)
- Most features in https://clangd.llvm.org/features are supported under swift code
- Since plugin didn't support .swiftinterfce
.swiftdoc
not being able to open the module's viewer like in xcode can be frustrating (swift-server/vscode-swift#408)
Could you tell me more about this BSP server? Can sourcekit-lsp not just take in a compile_commands.json?
- Yes, sourcekit-lsp can not take in a compile_commands.json but I found an injection point(seems that it was used for testing or remote indexing) in BuildServerBuildSystem
- We can inject our compile commands into sourcekit-lsp by creating a buildServer.json
- Build a server implement the BuildServerProtocol
- Finally there are two file generated by refresh_compile_commands
in root of the workspace
- compile_commands.json
- buildServer.json
I have pushed my fork and created a sample project (https://github.com/xinzhengzhang/bazel-compile-commands-extractor/blob/feature/swift-commands/examples/ios/README.md)
- cd examples/ios
- bazel build //:app
- for building swiftmodule
- bazel run //:build_bsp
- code .
from bazel-compile-commands-extractor.
Sweet! Thanks for all your good work. I need to head to bed now (it's super late my time), but I'll come back to this.
Re compile_commands.json, you're sure? I thought I saw references to watching compile_commands.json in the code for sourckit-lsp, and I see some references in the Q&A. Obviously I'm eager to simplify/not run a server if we don't have to, but I know you've played around with this much more than I have and probably had good reason to spend time writing the server :) Where does supplying a compile_commands.json fall short?
Anyway, once we've got the question of the simplest overall approach resolved, let's unify implementations! :) Ideally we'd make this work automatically for people (i.e. automatically generating swift entries if they're compiling swift code) and sharing almost all of the implementation between the languages.
from bazel-compile-commands-extractor.
I didn't noticed that there is another branch to CompilationDatabaseBuildSystem and went to investigate BuildServerBuildSystem
and everything as usual when I removed buildServer.json!
Fortunately, it didn't waste too much time on the service because it is just a forwarding of compilation commands. The server part has been removed in my branch
from bazel-compile-commands-extractor.
Oh yay! That simplifies things greatly.
Could I ask you to reunify the extractor implementations, and then PR it up so we can merge in? Looks like the two of you guys might work together at bilibili? Feel free to submit incremental patches, if that's faster and easier. Happy to help if things get stuck.
from bazel-compile-commands-extractor.
Hey Chris @cpsauer ,
Can you please to help me review it? #89
from bazel-compile-commands-extractor.
Definitely. Sorry for being a bit slow, @xinzhengzhang. Took a quick break for thanksgiving and am scrambling to catch back up. Reading now! Will continue discussion over on #89
And again, thank you!
from bazel-compile-commands-extractor.
Related Issues (20)
- ModuleNotFoundError: No module named 'orjson.orjson' HOT 14
- The current user is root, please run as non-root when using the hermetic Python interpreter HOT 4
- [Self-filed] Switch back to rules_python when their issues are fixed HOT 2
- nvcc fatal : Cannot find compiler 'cl.exe' in PATH HOT 4
- Relevant arguments are lost by the `bazel aquery ...` portion of compile command generation HOT 6
- protobufs not working in clangd HOT 1
- Suggested integration with VSCode HOT 1
- refreshAll failed to find C++ standard library if I specify '--sysroot' HOT 5
- clangd failed to find compilation database for dependency code HOT 6
- name 'module_extension' is not defined when used in Tensorflow-1.15.5 version HOT 4
- Linker error - collect2: fatal error: cannot find 'ld' HOT 1
- YCM reporting errors not present when code is actually built HOT 9
- sysroot handling is wrong in certain cases HOT 3
- Error when use with bazel --output_base flag HOT 5
- cuda_rules triggers assert "Something went wrong in makefile parsing to get headers. The target should be an object file."
- Third party library library from Bazel (sub)repository is not recognized HOT 3
- 'PurePosixPath' object has no attribute 'is_relative_to'
- When a giant project already has a folder called external in the root folder HOT 1
- Select usage example for refresh_compile_commands
- .o files appear in the current directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bazel-compile-commands-extractor.