Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: should download latest release on install #68

Merged
merged 15 commits into from
Aug 11, 2023
Merged

Conversation

tjdevries
Copy link
Collaborator

No description provided.

@tjdevries
Copy link
Collaborator Author

@pjlast / @mrnugget could you give this a go? I think this is ready to go. You should be able to wipe out your target directory in your repo and then just download this branch and run the build step, and everything should work.

If so, I'll merge, then do a version bump and no more build step for users :) just a quick download step.

@jamestrew
Copy link

First time user trying out this branch - this might not be strictly related to this branch but I'm having issues with initial start up.

Stack trace

Failed to source `/home/jt/.local/share/nvim/lazy/sg.nvim/plugin/cody.lua`

vim/_editor.lua:0: /home/jt/.dotfiles/nvim/.config/nvim/init.lua..nvim_exec2() called at /home/jt/.dotfiles/nvim/.config/nvim/init.lua:0../home/jt/.local/share/nvim/lazy/sg.nvim/plugin/cody.lua: Vim(source):E5113: Error while calling lua chunk: /home/jt/.local/share/nvim/lazy/sg.nvim/lua/sg/rpc.lua:4: attempt to index a boolean value
stack traceback:
	/home/jt/.local/share/nvim/lazy/sg.nvim/lua/sg/rpc.lua:4: in main chunk
	[C]: in function 'require'
	...t/.local/share/nvim/lazy/sg.nvim/lua/sg/cody/context.lua:1: in main chunk
	[C]: in function 'require'
	...hare/nvim/lazy/sg.nvim/lua/sg/components/cody_layout.lua:11: in main chunk
	[C]: in function 'require'
	.../.local/share/nvim/lazy/sg.nvim/lua/sg/cody/commands.lua:10: in main chunk
	[C]: in function 'require'
	/home/jt/.local/share/nvim/lazy/sg.nvim/plugin/cody.lua:9: in main chunk
	[C]: in function 'nvim_exec2'
	vim/_editor.lua: in function 'cmd'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:467: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:466>
	[C]: in function 'xpcall'
	.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:110: in function 'try'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:466: in function 'source'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:425: in function 'source_runtime'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:393: in function 'packadd'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:328: in function '_load'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:184: in function 'load'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:116: in function 'startup'
	/home/jt/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:85: in function 'setup'
	/home/jt/.dotfiles/nvim/.config/nvim/init.lua:20: in main chunk

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/.dotfiles/nvim/.config/nvim/init.lua:20


Failed to source `/home/jt/.local/share/nvim/lazy/sg.nvim/plugin/sg.lua`

vim/_editor.lua:0: /home/jt/.dotfiles/nvim/.config/nvim/init.lua..nvim_exec2() called at /home/jt/.dotfiles/nvim/.config/nvim/init.lua:0../home/jt/.local/share/nvim/lazy/sg.nvim/plugin/sg.lua: Vim(source):E5113: Error while calling lua chunk: /home/jt/.local/share/nvim/lazy/sg.nvim/lua/sg/bufread.lua:5: loop or previous error loading module 'sg.rpc'
stack traceback:
	[C]: in function 'require'
	/home/jt/.local/share/nvim/lazy/sg.nvim/lua/sg/bufread.lua:5: in main chunk
	[C]: in function 'require'
	/home/jt/.local/share/nvim/lazy/sg.nvim/plugin/sg.lua:9: in main chunk
	[C]: in function 'nvim_exec2'
	vim/_editor.lua: in function 'cmd'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:467: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:466>
	[C]: in function 'xpcall'
	.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:110: in function 'try'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:466: in function 'source'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:425: in function 'source_runtime'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:393: in function 'packadd'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:328: in function '_load'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:184: in function 'load'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:116: in function 'startup'
	/home/jt/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:85: in function 'setup'
	/home/jt/.dotfiles/nvim/.config/nvim/init.lua:20: in main chunk

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/.dotfiles/nvim/.config/nvim/init.lua:20

require("sg.request") seems to be returning a boolean so require("sg.request").request is erroring out.

This is pre setting up sourcegraph login/auth via :SourceGraphLogin.
Trouble is, the SourceGraphLogin command fails to get created due to the error. Entirely possible this is user error but on the off chance it isn't, it's a bit of a catch 22 situation for new users.

@mrnugget
Copy link
Contributor

mrnugget commented Aug 9, 2023

@tjdevries works! I just wiped everything from disk, added plugin, PlugInstall, saw "Downloading binaries..." briefly

screenshot_2023-08-09_16 12 08@2x

The only thing that confused me: I think I have to restart Vim after the installation for the Cody* commands to be registered

@tjdevries
Copy link
Collaborator Author

@jamestrew I pushed a new version of this, which should prevent the errors from happening.

Also though, it's :SourcegraphLogin not :SourceGraphLogin -- does the first command show up?

Copy link

@jamestrew jamestrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's something sus happening around

sg.nvim/lua/sg/auth.lua

Lines 118 to 121 in 6138d65

local cody_data = data.get_cody_data()
cody_data.token = data.token
cody_data.endpoint = data.endpoint
data.write_cody_data(cody_data)

I don't think the auth data is actually being saved correctly. So even though the SourcegraphLogin command shows up for me now (typo in my earlier comment), I still get caught on require("sg.request").request.

If I set up env variables for SRC_ENDPOINT, SRC_ACCESS_TOKEN, things look good though.
I do get some logging happening in the command line, but I take it that's just part of the pre-release nature of this plugin.

@@ -1,6 +1,10 @@
---@tag sg.rpc
---@config { ["module"] = "sg.rpc" }

if not require "sg.request" then
Copy link

@jamestrew jamestrew Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like with no login/auth, require "sg.request" is literally true so this condition will pass and still lead to the bad attribute access on line 8.

@tjdevries
Copy link
Collaborator Author

@jamestrew check last commit... haha i figured it out

@tjdevries tjdevries merged commit d8ddfc2 into master Aug 11, 2023
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants