Closed wojciech-kulik closed 1 year ago
Hello @wojciech-kulik Thanks for reporting. Sorry for your troubles.
It's seems an issue with telescope integration, perhaps the project info isn't correctly stored.
require'xbase.server'.roots
require("xbase.state")
Thank you for the quick answer! :)
What version of neovim and the commit of?
NVIM v0.8.3 Build type: Release LuaJIT 2.1.0-beta3 Compiled by brew@Ventura-arm64.local
when you open neovim in the project root directory, do you get confirmation that that xbase is connected?
Yes:
Is there a xbase process running? You mentioned that no logs found, try to look inti tmp folder
How can I check it? I run this from nvim and I don't see any xbase process:
what's the output of require'xbase.server'.roots what's the output of require("xbase.state")
I'm sorry, but I'm a new nvim user, where should I put it to see?
How can I check it? I run this from nvim and I don't see any xbase process:
Hmmm it's seems is not running. Try to run it manual, You can find the binary in ~/.local/share/xbase
, if not found, perhaps make install failed
what's the output of require'xbase.server'.roots
what's the output of require("xbase.state")
I'm sorry, but I'm a new nvim user, where should I put it to see?
That's okay, one possible way is to run it in the command line of neovim, for example, lua print(vim.inspect(require("xbase.state"))
xbase.state
returns:
{
project_info = {}
}
require'xbase.server'.roots
returns {}
I don't have this folder ~/.local/share/xbase
, but I have: ~/.local/share/nvim/lazy/xbase/
. So I guess the source code is downloaded but the installation failed?
what should I run from here?
I don't know if it makes sense but I tried to run make install
in this folder and I got:
Ok, I managed to fix this problem. It turned out that I needed cargo, so one extra step was missing - to install:
curl https://sh.rustup.rs -sSf | sh
Then I ran make install
and restarted nvim. Now the xbase
process is running but the error is the same :D
However, now I can see logs, so I will try to investigate what's the problem and I will let you know. Thanks for your patience!
Ok, so I see some problems. My guess is that it won't work with CocoaPods? It looks like it uses only xcodeproj
, am I right?
But I tried with a sample project that uses only xcodeproj
. Although it prints some errors, it looks like the build works and I was able to run it.
Actually, you can try this project on your own: https://github.com/wojciech-kulik/SwiftUI-Redux-Demo
The main problem that I have with iOS development in nvim is that the code completion doesn't work as expected and navigation to implementation/definition/references doesn't work. Is it possible to do something about that? As far as I read, it is a problem that the LSP doesn't understand the project structure?
@wojciech-kulik Thanks so much for debugging, reaching to the root of it, and providing a repo I can use to debug further.
I will try today use the repo to debug it further and make it work.
@wojciech-kulik I just ran the https://github.com/wojciech-kulik/SwiftUI-Redux-Demo on my environment.
.compile
was created with empty array.I'm guessing permission issues, with some parsing issues. I will build in debug and run the build command manually to see whats wrong exactly. More later
@wojciech-kulik Quick update.
It turned out the project did compile successfully. However, SwiftDriver
wasn't support in xcode log parser at all. Now, in local environment I can confirm that LSP features works.
Next I'm going fix the issue with the parser seeing SwiftCompile
and swift-frontend
as an error 😒, which the main cause of "the decode function error" in neovim. I must've add catch all logic to treat any unrecognizable log as error, if that the case, ... what a bad decision it was.
Finally, with new release of xclog and updating the tag in xbase it should work flawlessly.
Great to hear! Thank you for the update. I'm glad you were able to crack it! Good job and thank you for your engagement! 🚀 🎊
@wojciech-kulik please update your local version of xbase to latest version and should work without any issues 🤞🤞
I updated xbase, but I still get some errors:
Also, I have problems with LSP, I'm not sure if this is related with sourcekit-lsp or xbase but I'm never able to go to declaration/implementation or something like that.
For example:
dismissScreen
gd
, gD
, gI
, gr
- nothing works Is it possible at all to make swift LSP work properly for iOS projects? I think I read somewhere that LSP doesn't understand project structure so it doesn't work across multiple Swift files. Is it true?
hmmm just to confirm, you did run make install in xbase root, right? edit: also git pull
Is it possible at all to make swift LSP work properly for iOS projects? I think I read somewhere that LSP doesn't understand project structure so it doesn't work across multiple Swift files. Is it true?
Yes, and that's why xbase has it's own build server called sourcekit helper that solves these issues.
edit: my bad, for lsp to work now, you would need to remove .compile manually. It must be reading the old one (gets automatically updated on project structure change)
Oh, I didn't know I need to call make install
because it was in my config file. But once I did that it worked! 🎊 Also LSP started working when I removed the .compile
file 🚀.
Although I still have an issue when I try to run the app. When I use <leader>ef
and pick Run
I see an empty list:
LSP questions:
gd
works great, is it possible to see also references (gr
)? It doesn't work for me. gI
) - for example, when I type gI
on the protocol method, is it possible to navigate to the implementation?Improvements:
In Xbase logs it would be really nice to see a green message like Build succeeded
. Now it's a little bit hard to spot what's going on at the first glance:
Great job ❤️
Congratulations 🎉🎉🎉
Although I still have an issue when I try to run the app. When I use
<leader>ef
and pickRun
I see an empty list:
Yes, the empty list. I had the exact same issue and that led to https://github.com/kkharji/xbase/pull/182. In my case I had "iPhone 13 Pro"
In simctl.iOS
list, which is outdated. If you have not configured it, it means a bug in the logic of processing custom configuration assuming it will always be non empty. Try adding
"iPhone 14 Pro"
and let me know
LSP questions:
gd
works great, is it possible to see also references (gr
)? It doesn't work for me.
Yeah in term of reference sourcekit it self lacks support, Xcode has custom setup to enable this. Please open a feature request for that. I will look into having the feature builtin.
- The same question for the implementation (
gI
) - for example, when I typegI
on the protocol method, is it possible to navigate to the implementation?
Not sure, but if it does not work, then same as the above.
Improvements:
In Xbase logs it would be really nice to see a green message like
Build succeeded
. Now it's a little bit hard to spot what's going on at the first glance:
Great suggestion, it should be super easy to implement (xbase has its own syntax highlighting for logs) please open a feature request.
This is my config:
I've got iPhone 14
installed, but I'm still not seeing it on the list
UPDATE:
Uhh, I missed iOS = { "iPhone 14" }
. Now It works!
This is my config:
I've got
iPhone 14
installed, but I'm still not seeing it on the list
I'm guessing you have different set of devices recognized by xbase. What is the output of lua print(vim.inspect(require"xbase.state"))
UPDATE: Uhh, I missed iOS = { "iPhone 14" }. Now It works!
Great the bug is confirmed, I will open an issue for that and push a fix soon to cover the case of empty configuration.
I updated my answer while you answered (now it works) 🎊
I've got one last thing. Does xbase support xcworkspace? Most of my projects is using CocoaPods which generate xcworkspace
. I was trying to use xbase with my project and it doesn't work. My guess is that CocoaPods/xcworkspace is causing the problem.
You could reproduce it on this project: https://github.com/wojciech-kulik/Swift-MVVMC-Demo
@wojciech-kulik Please feel free to close the issue if the problem is solved. The issue is getting too big🫢. Also don't forget feature requests for your suggestions
I updated my answer while you answered (now it works) 🎊
I've got one last thing. Does xbase support xcworkspace? Most of my projects is using CocoaPods which generate
xcworkspace
. I was trying to use xbase with my project and it doesn't work. My guess is that CocoaPods/xcworkspace is causing the problem.You could reproduce it on this project:
Yes, I believe it is supported according to #86 and #101. I will double check it tomorrow and open an issue and mention you in case, it does not.
I added feature requests mentioned in this conversation: #188, #189, #190. Thank you one more time for all the help! Great job 🎊 🚀 🔥
I'm using macOS 13.3.1, M1 Pro, Xcode 14.3, lazyvim and I'm unable to make this plugin work.
I tested it on 3 projects and on all of them I get the same error. All those projects are using xcodegen for project generation.
So I installed the plugin like that:
Then I open nvim in the root folder of my project, where
project.yml
is located, I open some swift file likeAppDelegate.swift
and I use<leader>b
mapping then I always get:I tried to follow debug steps but there are no logs.