RE: https://github.com/sourcegraph/sourcegraph/issues/50876 This PR addresses the issues raised by a customer and beyang ([slack thread](https://sourcegraph.slack.com/archives/C04NPH6SZMW/p1681861031576389?thread_ts=1681859730.152309&channel=C04NPH6SZMW&message_ts=1681861031.576389)) regarding cody.codebase: 1. make it visible to the user what context mechanism is being used 1. we should fall back to keyword search if embeddings don't work 1. also lack of embeddings should surface a user-visible error ### PR Summary #### Issue 1: make it visible to the user what context mechanism is being used Solution from this PR: Show the current fetching method in the lower left corner   #### Issue 2: fall back to keyword search when embedding is not available Solution from this PR: Fallback to keyword search when: - codebase is not provided - embeddings are not available for the current codebase When codebase is not provided and the cody.useContext is set to 'embedding' or 'blended', we will now fallback to use keyword search (see context fetching mode in lower left corner)  When code is provided but Cody is unable to connect to the codebase, we will now fallback to use keyword search (see context fetching mode in lower left corner)  #### Issue 4: lack of embeddings should surface a user-visible error Solution from this PR: display message on codebase change / invalid codebase in UI (see screenshots above) When the cody.codebase is change, a pop up will also show up and ask user to reload VS Code (see lower right corner):  #### other minor fix - Disable chat submission on enter key press when chat is in progress ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> See screenshot shared above. Passed all unit test ``` PASS cody src/configuration.test.ts PASS cody src/completions/context.test.ts PASS cody src/keyword-context/local-keyword-context-fetcher.test.ts Test Suites: 3 passed, 3 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 2.127 s Ran all test suites. ``` --------- Co-authored-by: Philipp Spiess <hello@philippspiess.com> |
||
|---|---|---|
| .aspect | ||
| .buildkite | ||
| .github | ||
| .vscode | ||
| client | ||
| cmd | ||
| dev | ||
| doc | ||
| docker-images | ||
| enterprise | ||
| internal | ||
| lib | ||
| migrations | ||
| monitoring | ||
| schema | ||
| src-tauri | ||
| third_party | ||
| third-party-licenses | ||
| ui/assets | ||
| wolfi-images | ||
| wolfi-packages | ||
| .bazel_fix_commands.json | ||
| .bazelignore | ||
| .bazeliskrc | ||
| .bazelrc | ||
| .bazelversion | ||
| .browserslistrc | ||
| .dockerignore | ||
| .editorconfig | ||
| .eslintignore | ||
| .eslintrc.js | ||
| .gitattributes | ||
| .gitignore | ||
| .graphqlrc.yml | ||
| .hadolint.yaml | ||
| .mailmap | ||
| .mocharc.js | ||
| .npmrc | ||
| .percy.yml | ||
| .prettierignore | ||
| .stylelintignore | ||
| .stylelintrc.json | ||
| .tool-versions | ||
| .trivyignore | ||
| babel.config.jest.js | ||
| babel.config.js | ||
| BUILD.bazel | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| deps.bzl | ||
| doc.go | ||
| flake.lock | ||
| flake.nix | ||
| gen.go | ||
| go.mod | ||
| go.sum | ||
| graphql-schema-linter.config.js | ||
| gulpfile.js | ||
| jest.config.base.js | ||
| jest.config.js | ||
| jest.snapshot-resolver.js | ||
| LICENSE | ||
| LICENSE.apache | ||
| LICENSE.enterprise | ||
| lighthouserc.js | ||
| linter_deps.bzl | ||
| mockgen.temp.yaml | ||
| mockgen.test.yaml | ||
| mockgen.yaml | ||
| nogo_config.json | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| postcss.config.js | ||
| prettier.config.js | ||
| README.md | ||
| renovate.json | ||
| SECURITY.md | ||
| service-catalog.yaml | ||
| sg.config.yaml | ||
| shell.nix | ||
| svgo.config.js | ||
| tsconfig.all.json | ||
| tsconfig.base.json | ||
| tsconfig.eslint.json | ||
| WORKSPACE | ||
Docs •
Contributing •
Twitter •
Discord
Sourcegraph makes it easy to read, write, and fix code—even in big, complex codebases.
- Code search: Search all of your repositories across all branches and all code hosts.
- Code intelligence: Navigate code, find references, see code owners, trace history, and more.
- Fix and refactor: Roll out large-scale changes to many repositories at once and track big migrations.
Getting started
- Download Sourcegraph for macOS and Linux
- Use Sourcegraph on the cloud or self-hosted
- Sourcegraph.com public code search
Development
Refer to the Developing Sourcegraph guide to get started.
Documentation
The doc directory has additional documentation for developing and understanding Sourcegraph:
- Project FAQ
- Architecture: high-level architecture
- Database setup: database best practices
- Go style guide
- Documentation style guide
- GraphQL API: useful tips when modifying the GraphQL API
- Contributing
License
This repository contains both OSS-licensed and non-OSS-licensed files. We maintain one repository rather than two separate repositories mainly for development convenience.
All files in the enterprise and client/web/src/enterprise fall under LICENSE.enterprise.
The remaining files fall under the Apache 2 license. Sourcegraph OSS is built only from the Apache-licensed files in this repository.