Skip to content

Commit

Permalink
doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdevries committed Dec 13, 2023
1 parent b036b69 commit 7d8e3ac
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 181 deletions.
117 changes: 0 additions & 117 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ gix = "0.52.0"
tiny_http = "0.12.0"
keyring = "2.1.0"
whoami = "1.4.1"
dialoguer = "0.11.0"

[workspace.dependencies]
anyhow = "1"
Expand Down
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
see if i can put secret storage in the agent
- vscode check to see if i can stub out the secrets stuff

# sg.nvim

**Status**: Beta
Expand All @@ -11,19 +8,17 @@ see if i can put secret storage in the agent
- [Installation](#installation)
- [Configuration](#configuration)

sg.nvim is a plugin focused on bringing many of the features of sourcegraph.com into Neovim.
sg.nvim is a plugin focused on bringing many of the features of sourcegraph.com and Cody into Neovim.

## Setup

To configure logging in:
To Log In, either:

- Log in on your Sourcegraph instance.
- Click your user menu in the top right, then select Settings > Access tokens.
- Create your access token, and then run `:SourcegraphLogin` in your neovim editor after installation.
- Type in the link to your Sourcegraph instance (for example: `https://sourcegraph.com`)
- And then paste in your access token.
- Run `:SourcegraphLogin` after following installation instructions for `sourcegraph.com` usage.
- Use the `SRC_ENDPOINT` and `SRC_ACCESS_TOKEN` environment variables to manage tokens for enterprise usage.
- See :[src-cli](https://github.com/sourcegraph/src-cli#log-into-your-sourcegraph-instance) for more info

An alternative to this is to use the environment variables specified for [src-cli](https://github.com/sourcegraph/src-cli#log-into-your-sourcegraph-instance).
See `:help sg.auth` for more information.

You can check that you're logged in by then running `:checkhealth sg`

Expand All @@ -43,6 +38,8 @@ Requires:

### Install

Regardless of installation method, you must call `require("sg").setup { ... }` in your config.

<details>
<summary><code>lazy.nvim</code></summary>

Expand Down Expand Up @@ -126,8 +123,8 @@ nnoremap <space>ss <cmd>lua require('sg.extensions.telescope').fuzzy_search_resu
Cody:

- [x] Chat interface and associated commands
- [ ] Autocompletions, prompted
- [ ] Autocompletions, suggested
- [x] Autocompletions, prompted
- [x] Autocompletions, suggested

Sourcegraph Browsing:

Expand All @@ -146,14 +143,10 @@ Sourcegraph Browsing:
- [x] Goto Definition
- [ ] Goto References
- [x] <20 references
- [ ] kind of broken right now for lots of references
- [x] Basic Search
- [x] literal, regexp and structural search support
- [x] `type:symbol` support
- [ ] repo support
- [ ] Advanced Search Features
- [ ] Autocompletion
- [ ] Memory of last searches
- More? Make an issue with something you're missing :)


Expand Down
14 changes: 3 additions & 11 deletions lua/sg/auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
--- How to manage authentication for Sourcegraph within Neovim
--- (both for Cody and for Sourcegraph)
---
--- To manage your sourcegraph account, visit:
--- - https://sourcegraph.com/cody/manage
---
--- Use SRC_ENDPOINT and SRC_ACCESS_TOKEN environment variables to
--- manually override previous configuration.
---
Expand All @@ -30,17 +33,6 @@ end
local endpoint = vim.env.SRC_ENDPOINT
local token = vim.env.SRC_ACCESS_TOKEN

-- TODO: Don't know if this is a good idea or not
-- local timer = vim.loop.new_timer()
-- timer:start(
-- 0,
-- 10000,
-- vim.schedule_wrap(function()
-- endpoint = vim.env.SRC_ENDPOINT
-- token = vim.env.SRC_ACCESS_TOKEN
-- end)
-- )

--- Gets authorization from the environment variables.
--- It is possible these will be initialized from previous
--- session configuration, if not already present.
Expand Down
1 change: 1 addition & 0 deletions lua/sg/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ local report_cody_account = function()
-- This isn't sensitive, but I think it's just confusing for users
user_info.id = nil

vim.health.info "To manage your Cody Account, navigate to: https://sourcegraph.com/cody/manage"
vim.health.ok(string.format("Cody Account Information: %s", vim.inspect(user_info)))
return true
end
Expand Down
21 changes: 0 additions & 21 deletions src/bin/sg-auth-test.rs

This file was deleted.

15 changes: 1 addition & 14 deletions src/bin/sg-nvim-agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,11 @@ async fn main() -> Result<()> {
});

let notifications: JoinHandle<Result<()>> = tokio::spawn(async move {
// let stdout = stdout.clone();

// .auth/github/login?pc=https%3A%2F%2Fgithub.com%2F%3A%3Ae917b2b7fa9040e1edd4
// &redirect=/post-sign-up?returnTo=/user/settings/tokens/new/callback?requestFrom=JETBRAINS-$port"

while let Some(task) = rx.recv().await {
match task {
NeovimTasks::Authentication { port } => {
std::thread::spawn(|| {
std::thread::spawn(move || {
let server = tiny_http::Server::http(format!("127.0.0.1:{port}")).unwrap();
let addr = server.server_addr();
let ip = match addr {
tiny_http::ListenAddr::IP(ip) => ip,
_ => todo!(),
};

// TODO: Get a neovim one (but this is fine for now)

let request = server.recv().expect("to launch request");

// Create url to parse the parameters, a bit goofy but it is what it is
Expand Down

0 comments on commit 7d8e3ac

Please sign in to comment.