mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
Cody: add support for neovim, cody-cli, eclipse, and visualstudio clients (#63851)
Fixes CODY-2884 Previously, the server could respond with a 406 error when encountering clients with the following names: cody-cli, eclipse, and visualstudio. This error seems to only happen for enterprise clients. This PR fixes the problem by adding special cases for these clients like we already have for jetbrains and cody web. <!-- PR description tips: https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e --> ## Test plan See updated test case. <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> ## Changelog - Fix HTTP 406 error when using the Neovim Cody plugin with Enterprise instances <!-- OPTIONAL; info at https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c -->
This commit is contained in:
parent
20adc60d67
commit
7bc210bd4e
@ -555,6 +555,10 @@ func checkClientCodyIgnoreCompatibility(ctx context.Context, db database.DB, r *
|
||||
}
|
||||
var cvc clientVersionConstraint
|
||||
switch clientName {
|
||||
case types.CodyClientEclipse:
|
||||
case types.CodyClientVisualStudio:
|
||||
case types.CodyClientNeovim:
|
||||
case types.CodyClientCli:
|
||||
case types.CodyClientWeb:
|
||||
// Cody Web is of the same version as the Sourcegraph instance, thus no version constraint is needed.
|
||||
return nil
|
||||
@ -572,7 +576,15 @@ func checkClientCodyIgnoreCompatibility(ctx context.Context, db database.DB, r *
|
||||
}
|
||||
default:
|
||||
return &codyIgnoreCompatibilityError{
|
||||
reason: fmt.Sprintf("please use one of the supported clients: %s, %s, %s.", types.CodyClientVscode, types.CodyClientJetbrains, types.CodyClientWeb),
|
||||
reason: fmt.Sprintf("please use one of the supported clients: %s, %s, %s, %s, %s, %s, %s.",
|
||||
types.CodyClientVscode,
|
||||
types.CodyClientJetbrains,
|
||||
types.CodyClientWeb,
|
||||
types.CodyClientEclipse,
|
||||
types.CodyClientCli,
|
||||
types.CodyClientVisualStudio,
|
||||
types.CodyClientNeovim,
|
||||
),
|
||||
statusCode: http.StatusNotAcceptable,
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,15 @@ func TestCheckClientCodyIgnoreCompatibility(t *testing.T) {
|
||||
"client-name": []string{"sublime"},
|
||||
},
|
||||
want: &codyIgnoreCompatibilityError{
|
||||
reason: fmt.Sprintf("please use one of the supported clients: %s, %s, %s.", types.CodyClientVscode, types.CodyClientJetbrains, types.CodyClientWeb),
|
||||
reason: fmt.Sprintf("please use one of the supported clients: %s, %s, %s, %s, %s, %s, %s.",
|
||||
types.CodyClientVscode,
|
||||
types.CodyClientJetbrains,
|
||||
types.CodyClientWeb,
|
||||
types.CodyClientEclipse,
|
||||
types.CodyClientCli,
|
||||
types.CodyClientVisualStudio,
|
||||
types.CodyClientNeovim,
|
||||
),
|
||||
statusCode: http.StatusNotAcceptable,
|
||||
},
|
||||
},
|
||||
|
||||
@ -227,9 +227,13 @@ const (
|
||||
type CodyClientName string
|
||||
|
||||
const (
|
||||
CodyClientWeb CodyClientName = "web"
|
||||
CodyClientVscode CodyClientName = "vscode"
|
||||
CodyClientJetbrains CodyClientName = "jetbrains"
|
||||
CodyClientWeb CodyClientName = "web"
|
||||
CodyClientVscode CodyClientName = "vscode"
|
||||
CodyClientJetbrains CodyClientName = "jetbrains"
|
||||
CodyClientEclipse CodyClientName = "eclipse"
|
||||
CodyClientVisualStudio CodyClientName = "visualstudio"
|
||||
CodyClientNeovim CodyClientName = "neovim"
|
||||
CodyClientCli CodyClientName = "cody-cli"
|
||||
)
|
||||
|
||||
type CompletionRequest struct {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user