This PR refactors notebooks to support the upcoming Keyword Search GA. The main goal is to make it easier to switch to a new default pattern type without breaking existing notebooks.
**Before**
- pattern type and version were hardcoded in several places
**After**
- Each notebook has a read-only pattern type as determined by the new column `notebooks.pattern_type` (defaults to "standard").
**Notes**
- Notebooks call the Stream API via various helper functions. `patternType` and `version` are both required parameters, which is redundant, because version acts as a default pattern type already. I left a TODO in the code for that. I don't want to change this as part of this PR because the change would get very big and affect too much code outside of Notebooks.
- We support rendering notebooks with `.snb.md` extension. Unlike notebooks stored in our db, we cannot migrate those files.
**Q&A**
Q: How does this help for Keyword Search GA?
A: Once we default to keyword search, we can change the default of `notebooks.pattern_type` from "standard" to "keyword". Existing notebooks will still work with "standard". New Notebooks will use "keyword".
Q: How can customers migrate existing notebooks to a new version?
A: Use the existing "Copy to My Notebooks" function of Notebooks. The copied notebook will have the current default pattern type.
Test plan:
- existing tests pass
- manual testing
- I created a couple of notebooks with all the different block types and verified via the network tab that all requests to the Stream API have the proper pattern type. I played around with different values in `notebooks.pattern_type` to make sure that the request parameters change.
The VSCode Search extension does not support file preview, so hide it
from the search results when the search originates from the VSCode
Search extension.
Example showing the file preview links (before this PR):
<img width="1511" alt="Screenshot 2024-06-28 at 09 42 26"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/552cef26-9109-487a-96dd-0789d758c074">
Example without the file preview links (after this PR):
<img width="1511" alt="Screenshot 2024-06-28 at 09 43 46"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/c53a1c8e-c27e-4958-808b-e5469745d182">
## Test plan
### Automated tests still pass
Including visual and functional tests of the file preview functionality.
### Build and run locally
#### Build
```
git switch peterguy/vscode-hide-preview-file-link
cd client/vscode
pnpm run build
```
#### Run
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- Run a search using the search bar.
- See that the file preview link
### Check that the file preview link exists in the web app
The web app uses the branded components also, so run `sg start` or `sg
start web-standalone`, do a search and see that the file preview link
still exists.
If you want to be an over-achiever, you can edit
`client/branded/src/search-ui/results/StreamingSearchResultsList.tsx`,
changing `hideFilePreviewButton = false,` to `hideFilePreviewButton =
true,` and reload the search results to see that the file preview link
disappears.
This implements the debug view for code intel ranges. Since we're doing
work here, it's very useful to be able scan the info while exploratory
testing and debugging.
Note that this does _not_ use the snapshot API. After #63473, everything
uses occurrences, so rather than rely on another API request, the only
argument to the debug extension is a set of occurrences. This is
particularly nice because it would be very easy to do things like:
- Show the occurrences as calculated from syntax highlighting data
- Show the occurrences before and after we make them non-overlapping
This commit fixes an issue with layout shifting while loading data in
the reference. The class/style was incorrectly applied causing
additional padding to be added while data was loading. This commit fixes
that and
- adds a divider between the last list item and the loader
- changes the default proxy to be S2. Dotcom didn't make sense anymore
now that `pnpm dev:dotcom` does that explicitly.
## Test plan
Manual testing
Description:
This PR introduces support for counting tokens within the Azure code and
updating these counts in Redis. The token counting logic is embedded
directly in the Azure code rather than using a standardized point for
all token counting logic.
Reasoning:
• Azure does not currently support obtaining token usage from their
streaming endpoint, unlike OpenAI.
• To enable immediate functionality, the token counting logic is placed
within the Azure code itself.
• The implementation supports GPT-4o.
Future Considerations:
• When Azure eventually adds support for token usage from the streaming
endpoint, we will migrate to using Azure’s built-in capabilities.
• This will ensure full utilization of Azure OpenAI features as they
achieve parity with OpenAI.
Changes:
• Added token counting logic to the Azure code.
• Updated Redis with the token counts.
Testing:
• Verified the implementation works with GPT-4o.
Conclusion:
This is a temporary solution to enable token counting in Azure. We will
adapt our approach as Azure enhances its feature set to include token
usage from their streaming endpoint.
## Test plan
Tested locally with debugger
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Fixes srch-646
This commit fixes how tokens are decorated in the query input. The
"chip" style needs to have lower presedence than the syntax highlighting
so that it doesn't get split across the individual parts of e.g. a repo
filter.
This commit also removes the activeFilter extension. It was conflicting
a bit with the filter decoration. This should be fine since it wasn't
used for quite a while in the main search input either.
I also noticed an issue with the size of the CodeMirror input in the
saved searches form. I couldn't enter any query actually because the
input was too "narrow". Adding `flex:1` fixes that.
## Test plan
Manual testing.

Contributes to srch-529
This commit refactors the main navigation and search home page code to
make it more configurable. In particular we now only show navigation
entries for features that are enabled (as determined by
`window.context`) and only show the cody upsell banner when cody is
enabled.
I extended the dev HTML template and .env files to support this.
## Test plan
Manual testing.
I found it annoying that it took 2 clicks to go to Cody chat: click
**Cody** in the global navbar, then click **Web Chat**. Users rarely
will visit their dashboard, and that's associated with their user
anyway, so it should be under their user. Same 2-click annoyance applies
to going to Code Search.
Moves some other links:
- Contexts, Search Jobs, Code Monitors, Notebooks --> moved to "Tools"
global navbar item
- Cody dashboard --> moved to user nav item (in top right)



## Test plan
With minimize nav on and off, and with all states of dotcom and
user-has-Cody-enabled, ensure matches expectations. The expectations are
codified in the tests/
## Changelog
- Code Search and Cody now are one-click links in the global navbar.
Other features are in the new "Tools" menu: search contexts, code
monitors, search jobs, and notebooks. Your Cody dashboard is linked from
your user menu (in the top right).
This is a bit of refactoring as a followup to #63217. The goal is to
unify how we use `Occurrences` so that we can use the same interface for
both syntax highlighting data and occurrence data from the new API. An
additional goal is to encode more of the invariants in the type system
so it's more difficult to use incorrectly.
This integrates the new occurrences API into the Svelte webapp. This
fixes a number of issues where the syntax highlighting data is not an
accurate way to determine hoverable tokens. It is currently behind the
setting `experimentalFeatures.enablePreciseOccurrences`
Due to changes in the code base, the search extension code when run from
`main` shows file names only in the search results page - no matches in
the files. This is a regression from the behavior in the deployed
extension.
Deployed extension:
<img width="1504" alt="Screenshot 2024-06-27 at 10 04 37"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/edd97903-d03f-4612-98c8-c8f286f0cb3b">
Running from `main`:
<img width="1502" alt="Screenshot 2024-06-27 at 10 11 17"
src="https://github.com/sourcegraph/sourcegraph/assets/129280/d7aefcfe-3a25-4486-9fa6-a5e6bc7c6a8e">
Turns out the reason is because some shared code expects chunk matches,
while the search queries were all returning line matches.
Added support for line matches in the shared code, and then fixed an
issue with the search results display not keeping up with `MatchGroups`.
## Test plan
Build and run locally.
### Build
```
git switch peterguy/vscode-bring-back-matched-lines-in-search-results
cd client/vscode
pnpm run build
```
### Run
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- Run a search using the search bar.
- See that the results contain matched lines in the files and not just a
list of file names. Compare to the currently-deployed extension - the
search results should look generally the same.
This is part of the Keyword GA Project.
Instead of hardcoding the pattern type to "standard" we use the default pattern type. This really only affects highlighting, because users are already forced to explicity state a pattern type by the GraphQL API.
Test plan:
- new unit test
- manual testing:
I tested the following workflows:
Creating a saved search from search results page
Creating a saved search from the user menu
Editing an existing saved search after the default patternType had changed
I noticed that the regexp toggle doesn't work anymore if `"search.defaultPatternType": "regexp"`. This is related to a recent change #63410.
We also append `patternType:keyword` in that case which I don't think we want, because we have an UI element to indicate that keyword search is active.
The question I don't know how to answer is: What should happen if `regexp` is the default and the user toggles keyword search off. Should we go back to `regexp` or to `standard`?
Test plan:
- new unit test
- manual testing with default pattern type set to "keyword" and "regexp".
Turn off 2 low-value eslint rules that add a lot of noise:
- `@typescript-eslint/no-explicit-any` because if you mean to use `any`
then you probably mean to. We still have eslint warnings for `any`
member access, which is indeed riskier.
- `@typescript-eslint/no-non-null-assertion` because if you type `!`
then you mean it.
Both of these have hundreds of warnings in our current codebase, so this
significantly reduces the eslint noise and makes it so that the
higher-value eslint rules are more noticeable.
At a high level, we don't want to show annoying ads/upsells for Cody
that are not useful. And if Cody is disabled, we don't want to show
*any* links to Cody.
### Detailed desired behavior
- Dotcom
- Navbar
- Unauthed: "Cody" single link to /cody (marketing page)
- Authed: "Cody" dropdown with "Dashboard" (/cody/manage) and "Chat"
(/cody/chat)
- Routes
- /cody: always the marketing page
- /cody/manage: requires sign-in, shows Cody PLG subscription status for
the user (Free plan is auto-opted-into by default)
- /cody/chat: requires sign-in
- Enterprise with Cody enabled on instance
- Navbar
- Cody NOT enabled for current user: "Cody" single link to
/cody/dashboard
- Cody enabled for current user: "Cody" dropdown with "Dashboard"
(/cody/manage) and "Chat" (/cody/chat)
- Routes
- /cody: this link should not be present anywhere, but redirect to
/cody/dashboard
- /cody/manage: informational page, with editor/web links for
Cody-enabled users and a "contact admin to get access" message for
Cody-disabled users
- /cody/chat: chat for Cody-enabled users, redirect to /cody/manage for
Cody-disabled users
- Enterprise with Cody NOT enabled on instance (`"cody.enabled": false`
in site config)
- Navbar: no Cody link or dropdown
- Routes: all Cody routes 404
- All
- Do not show a Cody upsell on the /search page
This is an example of what we will KEEP for users on instances with Cody
enabled but who do not themselves yet have access to Cody. This is
useful because it informs users how to get access to Cody, and
presumably their site admin wants people to request it who want to use
it.

Fixes
https://linear.app/sourcegraph/issue/SRCH-529/hide-cody-ai-tab-and-cody-upsell-if-cody-is-not-enabled
### Unexpected code changes needed
This ended up being a much bigger change than I expected because I found
error-prone code that needed cleaning up:
- Improve how we determine if Cody is enabled in the frontend code.
Previously, we checked the license features in some places,
`cody.enabled` site config in others, and the user's current RBAC
permissions for Cody in yet others. The most error-prone was checking
the license features, since a license may entitle the instance to Cody
but the site admin may still choose to disable it. There were no places
in the frontend code where checking the license's entitlements was
actually correct, so I changed everything to checking either
`window.context.codyEnabledOnInstance` or
`window.context.codyEnabledForCurrentUser`.
- Did the same for `window.context.codeSearchEnabledOnInstance` for
symmetry.
- Removed "helper" functions that just checked 1 or 2 boolean values on
`window.context` related to this, in favor of accessing `window.context`
directly. Globals aren't great, and we should use React context or
something similar, but now that the JSContext has the right fields
(i.e., enabled instead of licensed), it's simpler and there is no need
for helper functions.
- Removed prop drilling of the `licenseFeatures` that was unnecessary
since these values are available in globals and were being set from
globals at some arbitrary point in the React component hierarchy anyway.
- Updated the GlobalNavbar test snapshots.
## Test plan
Run in 3 modes: (1) dotcom mode, (2) `"cody.enabled": false` in site
config, (3) normal `sg start`.
## Changelog
- When Cody is disabled in site config (with `"cody.enabled": false`),
all links and UI elements about Cody are hidden from all users.
Previously, when Cody was disabled, users would see some links informing
them about Cody.
Historically, sourcegraph.com has been the only instance. It was
connected to GitHub.com and GitLab.com only.
Configuration should be as simple as possible, and we wanted everyone to
try it on any repo. So public repos were added on-demand when browsed
from these code hosts.
Since, dotcom is no longer the only instance, and this is a special case
that only exists for sourcegraph.com.
This causes a bunch of additional complexity and various extra code
paths that we don't test well enough today.
We want to make dotcom simpler to understand, so we've made the decision
to disable that feature, and instead we will maintain a list of
repositories that we have on the instance.
We already disallowed several repos half a year ago, by restricting size
of repos with few stars heavily.
This is basically just a continuation of that.
In the diff, you'll mostly find deletions. This PR does not do much
other than removing the code paths that were only enabled in dotcom mode
in the repo syncer, and then removes code that became unused as a result
of that.
## Test plan
Ran a dotcom mode instance locally, it did not behave differently than a
regular instance wrt. repo cloning.
We will need to verify during the rollout that we're not suddenly
hitting code paths that don't scale to the dotcom size.
## Changelog
Dotcom no longer clones repos on demand.
The New Cody Web client doesn't work for non-auth users, we should never
render
new Cody web client for signed-out users and show cody landing page
instead.
## Test plan
- Run local instance and sign out
- Check that Cody Web page shows the welcome landing page
This PR turns on the new Cody Web by default for everyone. It's still
possible to opt-out to the old Cody Web with `"newCodyWeb": false` in
your experimental features in settings.
I forgot that the dot com instance seeds its global settings and site
configuration from files and
doesn't allow us to override specific settings there;
## Test plan
- Check that the new Cody Web client is available to you without any
feature flag by default
This upgrades SvelteKit for good measure. I think a lot of the fixes are
not relevant to us but
https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fkit%402.5.8
is interesting and makes navigating around in the app after a dev server
start less jarring.
## Test plan
`pnpm dev`, `pnpm build` and `bazel test
//client/web-sveltekit:svelte-check`
Part of https://github.com/sourcegraph/sourcegraph/issues/62448
Linear issue
[SRCH-573](https://linear.app/sourcegraph/issue/SRCH-573/integrate-cody-web-package-into-the-sourcegraph-ui)
This is highly experimental usage of the new (not currently merged but
published in NPM `cody-web-experimental`) package
## How to run it
- (Optional) if you previously linked any local packages make sure they
don't exist in your node_modules anymore, `rm -rf node_modules` in the
root then `pnpm install`
- Run standard `sg start web-standalone`
- Turn on `newCodyWeb: true` in your `experimentalFeatures`
## How to run it locally with prototype PR in Cody repository
- Open Cody repository on the `vk/integrate-cody-web-chat-2` branch
- At the root of the repo, run `pnpm install` to make sure you're up to
date with all of the dependencies.
- Go to the web package (`cd web`)
- Build it with `pnpm build`
- Create a global link with `pnpm link --global` (Ignore the warning
message about no binary)
- Open sourcegraph/sourcegraph repository on this PR branch
- Make sure you are in the root of the repo.
- Run `pnpm link --global cody-web-experimental`
- Run `sg start web-standalone` to bundle the web app and launch an
instance that uses S2 for the backend. You'll need to create a login on
S2 that is not federated by GitHub.
- Turn on `newCodyWeb: true` in your `experimentalFeatures`
- Have fun experimenting!
## Test plan
- Check that old version of Cody has got no regressions
There are two kinds of repository pages: Those who depend on the
revision possibly present in the URL and those who are not.
This commit re-arranges the routes to better distinguish between these
two types. It also adds a visual indication to the commits that the
history at a specific revision is shown. Additionally it removes the
revision from links to revision agnostic pages.
Overall this should make it clearer to the user when and when not the
revision in the URL is relevant.
Note: I originally added a redirect for revision agnostic pages that
would remove the revision if it was present in the URL. I decided to
not do that for now because that redirect introduces an additional
history entry which makes it difficult to navigate back.
Closes srch-600
## Test plan
Manual testing.
This is part of the Keyword Search GA project (see background below).
The core change is that we use the default pattern type consistently for
the query input field and preview. Before, we hardcoded `literal` as the
default and used `standard` for previews.
This is does not affect existing code monitors.
Other fixes:
- highlight keyword queries correctly
Background:
- "keyword" will soon be the new default pattern type
- the default pattern type can be overridden in the user/global settings
- query fields in all of our products should respect the default
Test Plan:
- The unit test is currently "skipped" with the following comment
```
// TODO: these tests trigger an error with CodeMirror, complaining about being
// loaded twice, see https://github.com/uiwjs/react-codemirror/issues/506
```
- Manual testing:
- I created several code monitors with and without pattern type and
checked in the DB that the correct pattern type was appended.
- I configured a new default pattern type in my user settings and
verified that the setting changes the default pattern type for code
monitors.
Co-authored-by: Felix Kling <felix@felix-kling.de>
The current "name" thing is not used anywhere for subscriptions - all
internal capabilities and APIs depend use the UUID, and Enterprise
Portal will use the UUID as well.
This change replaces all name/IDs with the UUID, prefixed in Enterprise
Portal format, as we prepare to launch Enterprise Portal in more places
(such as Cody Analytics: https://linear.app/sourcegraph/issue/CORE-101).
This is particularly relevant for Cody Analytics so I can document how
to find the UUID in a way that isn't "get it from the URL".
It's not super beautiful in the subscriptions list, but as we progress
on the migration to Enterprise Portal I plan to replace the ID in the
list with "Display name", which is a first-class citizen in Enterprise
Portal.
## Test plan
<img width="953" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/23356519/30c4ae6b-e50b-485c-a2c8-e4ab6445fc01">

Previously, enabling then disabling the regexp toggle would always set the
patterntype to `keyword`, even when the user has set
`search.defaultPatternType: standard`. Now, toggles always revert back to the
default pattern type.
To support this, this PR adds `defaultPatternType` to the nav bar query state,
which is updated every time there's a settings update. Having
`defaultPatternType` available also lets us fix another bug: when
the default pattern type has been set to `standard` we no longer awkwardly show
`patterntype: standard` in the search bar. (This confusing behavior was
introduced recently in #63326.)
**Overall, this PR set us up to remove `experimentalFeatures.keywordSearch`,
along with the keyword search toggle.** To opt out of keyword search, users can
just set `search.defaultPatternType`, and have it work everywhere.
Codeintel v1 telemetry/event logging was broken in
https://github.com/sourcegraph/sourcegraph/pull/62586 due to the lack of
parens around a ternary operator. This simply fixes that issue.
## Test plan
CI
## Changelog
Co-authored-by: Dan Adler <5589410+dadlerj@users.noreply.github.com>
…orduct analytics)
As part of the v1 -> v2 telemetry transition, in product analytics
("IPA") aka admin analytics pages need to all be updated as well.
The codeintel IPA page shows codeintel actions by language. We aren't
capturing this metadata for v2 events. This PR adds it to private
metadata (since this is only needed on the instance itself).
## Test plan
CI
---------
Co-authored-by: Dan Adler <5589410+dadlerj@users.noreply.github.com>
Co-authored-by: Aditya Kalia <32119652+akalia25@users.noreply.github.com>
The general principle here is that we want to remove non-functional
upsells in our product. They add clutter and complexity and sometimes
annoy admins and users. As we unify the products, we will be adding a
lot more functional CTAs in the product to the same effect.
## Test plan
n/a; removal only
This page (at `/cody/search`) let you type in a natural-language
description of what to search for, and then it used an LLM to rewrite
that to Sourcegraph search query syntax. This was enabled using the
`cody-web-search` feature flag, which has been disabled on dotcom for a
while and was never documented or shared with customers, so it's safe to
remove.
It was a cool idea, but we decided to focus on making Cody's search in
the editor better, and we haven't seriously improved this for ~12
months.
## Test plan
n/a; removed feature
Repository embeddings were removed in Feb 2024 as part of the Cody
Enterprise GA. They have not been used since. Some Sourcegraph instances
still running an older pre-GA version may still rely on Cody Gateway
(deployed by us) for embeddings generation, but they do not rely on this
UI code at all, so it is safe to remove.
No changelog entry needed since this code's UI has been disabled since
Feb 2024.
## Test plan
Existing tests suffice since this is removing functionality.
Adds `dotcom.codyProConfig.useEmbeddedUI` site config param.
This param defines whether the Cody Pro subscription and team management
UI should be served from the connected instance running in the dotcom
mode. The default value is `false`. This change allows us to enable the
SSC proxy on the instance without enabling the new embedded Cody Pro UI.
Previously whether the embedded Cody Pro UI is enabled was defined by
the `dotcom.codyProConfig` being set, which prevented us from enabling
the SSC proxy without enabling the embedded UI:
> Whether the SSC proxy is enabled is [defined based on
`dotcom.codyProConfig`](41fb56d619/cmd/frontend/internal/ssc/ssc_proxy.go (L227-L231))
being set in the site config. This value is also partially
[propagated](41fb56d619/cmd/frontend/internal/app/jscontext/jscontext.go (L481))
to the frontend via jscontext. And the frontend [uses this
value](41fb56d619/client/web/src/cody/util.ts (L8-L18))
to define whether to use new embedded UI or not.
For more details see [this Slack
thread](https://sourcegraph.slack.com/archives/C05PC7AKFQV/p1719010292837099?thread_ts=1719000927.962429&cid=C05PC7AKFQV).
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- CI
- Tested manually:
- Run Sourcegraoh instance locally in dotcom mode
- Set `dotcom.codyProConfig` in the site config
- Type `context. frontendCodyProConfig` that it returns the [correct
values from the site
config](184da4ce4a/cmd/frontend/internal/app/jscontext/jscontext.go (L711-L715))
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
The name of the product is "Cody", not "Cody AI". Also, "AI" just looks
dumb and hype-y.
## Test plan
View the navbar and ensure it reads "Cody" not "Cody AI".
## Changelog
- In the navbar, Cody is now just "Cody" not "Cody AI".
This reverts commit 5cf81e0210
(https://github.com/sourcegraph/sourcegraph/pull/63378).
This PR intorduced a call to the SSC backend via proxy on the
Sourcegraph backend (see `cmd/frontend/internal/ssc/ssc_proxy.go`). It
appeared that proxy is not properly configured on dotcom, causing
requests to fail with 503 "proxy not configured" errors.
Reverting this PR until we fix the configuration.
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- CI
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Currently the fuzzy finder filters and ranks results received from the
server locally. This was done to improve performance since local
filtering is much faster.
However it can introduce inconsistencies (as reported) because the local
filtering logic works differently that the one on the server. That means
the shown results is depedent on on the local cache, which is not
obvious to the user.
This commit removes the client side filtering and ranking and instead
relies only on the server for this. This makes things more consistent
and predictable, at the expense of being a little slower. However it
still feels quite fast to me.
Note that I didn't implement some aspects due to the limitations of the
GraphQL-based search API:
- No match highlighting. Personally I didn't miss is it so far. I don't
know if the highlighting actually provides a lot of value.
- No total result count. It seems since we are adding `count:50`, the
server cannot actually give use an approximate total count. But we
should probably still convey somehow that we are limiting results to the
top 50.
Because we don't have locally cached data anymore that can be shown
immediately I decided to increase the throttle time to prevent the
result list flickering in and out when typing with a moderate speed.
This change enables three additional features: 'search all' mode, multi
word search and regex search via `/.../` literals (just like for normal
search queries). This is consistent with our existing search query
language (currently regex literals are not syntax highlighted, but we
should consider doing that).
Fixes srch-139
Fixes srch-133
Fixes srch-134
Fixes srch-543
https://github.com/sourcegraph/sourcegraph/assets/179026/81e24345-9e06-4df6-bb4a-8a55e433bfd1
## Test plan
Manual testing.
## Changelog
- Add 'search all' tab
- Support multi-word search
- Support regular expression patterns
- Fix matching reliability
When moving to ESBuild, the filenames for extension bundles changed,
which led to broken bitbucket plugins for example.
See
[discussion](https://sourcegraph.slack.com/archives/C04MYFW01NV/p1718902092493689)
## Test plan
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Inspected the relevant target to see the paths in their proper location.
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes https://github.com/sourcegraph/sourcegraph/issues/63234
[Design](https://www.figma.com/design/FMSdn1oKccJRHQPgf7053o/Cody-PLG-GA?node-id=5556-13856&t=f13ek1ZSgoUdrH6z-0)
Adds a button to remove the remaining invites from a subscription.
https://github.com/sourcegraph/sourcegraph/assets/25318659/679e19dd-0e0e-4561-8ac1-af1b6979ee73
**Known deviation from design (cc: @rrhyne)**
The “Remove User” success message and the “Remove Seats from
Subscription” alerts are positioned differently than in the design. The
“Remove User” banner, along with other user and invite list alerts, is
placed above the users list, below the page title or the invites textbox
if rendered. The “Remove Seats from Subscription” banner, along with
other invite textbox alerts, is located above the invites textbox
instead of above the page title and all the page content. These issues
will be addressed in follow-up PRs, as we need to refactor the existing
Team Members page layout.
Created an issue to address it:
- https://github.com/sourcegraph/sourcegraph/issues/63411
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- Run a Sourcegraph instance in dotcom mode
- Sign in as a team admin
- Ensure there are free seats on your team (invites remaining)
- Ensure "Remove invites from plan" button is rendered
- Check the number of invites remaining
- Click the button
- Ensure the subscription has been updated and now the max seats reduced
by the number of remaining invites
- Ensure the success banner is rendered
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes https://github.com/sourcegraph/sourcegraph/issues/63240
Adds a confirmation modal before revoking admin or removing user.
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
<img width="549" alt="Screenshot 2024-06-20 at 19 50 28"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/361bce61-b2c3-42da-8d3c-5389a7ba9bd2">
<img width="549" alt="Screenshot 2024-06-20 at 19 50 36"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/f0bbc9c7-2097-46af-a290-74551d99896e">
## Test plan
- Run Sourcegraph instance in dotcom mode
- Sign in as Cody Pro team site admin
- Navigate to "/cody/team/manage" page
- Click on remove button next to the team member
- Ensure the confirmation modal is visible
- Ensure clicking the cancel button closes the confirmation modal and
user is not removed
- Ensure clicking the confirm button removes the user and closes the
confirmation modal
- Click on the revoke admin button next to the team admin
- Repeat steps for the user removal
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Fixes srch-553
This commit changes the "selectline" handler to open the correct file
when the file view is embedded.
## Test plan
Manual testing. Open reference panel, click on reference to open preview
panel, click on line number in review panel.
- Updates enry to include languages from Linguist v7.29.0 such as Mojo etc.
- Updates auto-complete filters in frontend code.
- Updates Zoekt to pick up newer version with bumped enry dep.
- Updates language extension overrides to avoid ambiguity for `.json` and `.yml`.
- Updates snapshot tests.
Closes https://github.com/sourcegraph/sourcegraph/issues/63264
1. Adds Cody Pro section to the user nav dropdown on dotcom:
- team admins have links to "cody/subscription/manage" and
"cody/team/manage" pages
- team members have only link only to the "cody/team/manage" page
2. Makes subscription management page only available for team admins. If
team members try to navigate this page by changing the URL, they will be
redirected to the "/cody/manage" page.
- Makes "Manage subscription" link on the "/cody/manage" available only
for the team admins (previously - any Pro user)
3. Lifts `QueryClientProvider` (wrapper around react-query
`ClientProvider` higher in the component tree so that Cody Pro API query
and mutations can be used not only on the Cody Pro routes.
[Design](https://www.figma.com/design/FMSdn1oKccJRHQPgf7053o/Cody-PLG-GA?node-id=5351-19126&t=LfNQR7vUCJhlNvyT-4)
| Role | Screenshot |
|--|--|
|Admin|<img width="1605" alt="Screenshot 2024-06-20 at 12 57 13"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/e7b995fd-4322-4f7f-86bb-c7027cacd644"><img
width="1605" alt="Screenshot 2024-06-20 at 13 10 28"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/84be111c-76e2-4b14-9b73-ebdd5f8cbb9a">|
|Member|<img width="1605" alt="Screenshot 2024-06-20 at 12 56 50"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/aefd8b3b-29fe-4957-87ee-b493eb489922"><img
width="1605" alt="Screenshot 2024-06-20 at 13 09 51"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/8209e7a0-4deb-4681-9f6b-3cfde8110842">|
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- Start Sourcegraph instance in dotcom mode
- sign in as a Cody Pro team admin
- ensure that "Manage subscription" and "Manage team" links are present
in the user nav dropdown
- ensure "/cody/manage" page has "Manage subscription" link
- sign in as a Cody Pro team member (not admin)
- ensure "Manage team" link is present in the user nav dropdown
- navigate to "/cody/subscription/manage/ page by changing the URL
- ensure you've been redirected to the "/cody/manage" page
- ensure "/cody/manage" page doesn't have "Manage subscription" link
- start Sourcegraph in the enterprise mode
- ensure the mentioned links are not rendered
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes srch-458
This implements the new fuzzy finder design, specifically:
- Backdrop and dropshadow
- Border radius
- Tab header (affects all tab headers)
- Options
Note 1: Some aspects of the options UI (such as how paths are rendered
and highlighted), and the "footer" depend on how the highlighted parts
are computed. This will change when the local matching and ranking logic
is removed and will be updated when that happens.
Note 2: The symbol icon coloring was broken by #63288 and will be fixed
in a separate PR.
## Test plan
Manual testing
We plan to remove the 'Keyword Search' toggle as part of bringing the feature
to GA. Once the toggle is removed, the search UX will only represent `keyword`
(the default pattern type) and `regexp` (through the regex toggle), with no
visual indication for other pattern types. So if a user clicks on a link using
`patterntype:standard`, the search will just behave differently, without any
indication in the UX as to why.
This PR surfaces the `patterntype` filter in the search bar whenever it's not
`keyword` or `regexp`. That way, users can see an old pattern type is being
used and understand why the search behavior may be different.
Relates to SPLF-68
Whether or not the app is in "dotcom mode" is determined by
`window.context.sourcegraphDotComMode`. In development we use a stub
`window.context` object defined in `app.html`.
This commit extends that object to set `sourcegraphDotComMode` depending
on an environment varible. The environment variable is set by using vite
modes (https://vitejs.dev/guide/env-and-mode.html).
The whole setup can be started with `pnpm dev:dotcom`.
## Test plan
Ran `pnpm dev:dotcom` and saw the dotcom specific header and footer.
Two followups from implementing the repo menu:
1) Remove the rounded corners from the trigger button to match the rest
of the header
2) Add an external link icon to the code host link
VSCode extensions can use authentication providers to enable
authentication actions from the Accounts menu, and to allow for
federated authentication. The Sourcegraph Search extension needs neither
of those - it can meet all of its authentication needs with the existing
actions in is side panel.
On top of that, the authentication provider isn't implemented quite
correctly, which leads to issues like #43608.
This PR removes the authentication provider.
It retains all of the expected behavior of the extension: the user can
still authenticate against sourcegraph.com or private instances using an
access token, and log out.
## Test plan
### First
Build and run locally.
```
git switch peterguy/vscode-remove-auth-provider
cd client/vscode
pnpm run build
```
### Then
- Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
- Note that the Accounts icon does not display a "1" badge and "Sign in
with SOURCEGRAPH_AUTH" is not present in the menu.
- Click on `Have an account?` to open the login dialog.
- Enter an access token and the URL of the Sourcegraph instance to which
you would like to connect.
- Click `Authenticate account`.
- Check the Accounts icon and menu - should not be anything there that's
a result of Sourcegraph Search.
- In the Help and Feedback section, click your username to open the
logout panel, then log out.
- Note again, the lack of modifications to the Accounts icon and menu
from the Sourcegraph Search extension.
## Changelog
- Remove interaction between the Sourcegraph Search extension and the
Accounts menu.
Marks the `web-sveltekit:e2e_test` as flaky (tries them up to three
times). It just failed main on this build
db7a268c34
## Test plan
ci
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
The search console page is broken, is not used or maintained, and is
only referenced by a series of blog posts years ago. We have product
support to remove it.
Fixes srch-507
The panels code prevents event propagation of mouse move events, which
in turn seems to prevent SvelteKit from its own preloading logic.
Looking at the event handlers it seems they are global only (per
document), so I don't think that stopping the propagation is necessary
for the panel itself to work. However, I think it makes sense to stop
any of default event behavior when the mouse is currently pressed, since
that means the user is currently dragging a resize handler. Would love
to get @vovakulikov's confirmation that my understanding is correct.
## Test plan
Manual testing. Changing the size of a panel (e.g. repo page) seems to
work as expected. Hovering over a file tree entry preloads data and code
now, as visible in the network tab.
The tags page contains a `:global` selector at the root level, which
affects all elements that match the selector, even those not part of the
page.
`:global` selectors always need to be scoped one way or the other.
## Test plan
Code inspection, trivial change.
Fixes srch-545
We are hiding suggestions until the user has interacted with the input
(e.g. by clicking or typing), but, as it is not, it does not include
clicking on the history button.
This commit changes that.
## Test plan
Manual testing. Clicking the history button without having interacted
with the search input in any other way will now show history suggestions
and focus in the input.
In response to some customer feedback that multiple users thought this
meant their user's license was expiring, this updates the wording to
clarify that it's the sourcegraph instance license that's expiring.
Contributes to srch-578
Currently we keep showing the loading indicator even if no references
have been found. This commit moves the info messages into the layout
because the layout has information we need to properly distinguish the
different states.
I think more refactoring is necessary to make this API better but that
will be done as part of adding search-based code intel support.
## Test plan
Manual testing.
This patch does a few things:
- Adds `go-enry` packages to depguard, so that people do not
accidentally use enry APIs instead of the corresponding APIs
in the `languages` package.
- Adds more tests for different functions in the languages package
to ensure mutual consistency in how language<->extension mappings
are handled.
- Adds tests for enry upgrades
- Adds comments with IDs so that related parts in the code can be
pieced together easily
We didn't support secrets for bitbucket cloud so far, but the code host
does support them. They use the same mechanism as Bitbucket and GitHub
so that was easy to add.
Closes SRC-393
Test plan:
Set up a webhook locally and tested that with a wrong secret it fails,
and with the correct secret it passes. Also wrote a test.
Removes "/cody/invites/accept" page.
Invite processing is handled on the "/cody/manage" page and
"/cody/invites/accept" is used only to redirect to the former.
Backend counterpart:
https://github.com/sourcegraph/self-serve-cody/pull/886
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- Tested manually
- checkout branch
fromhttps://github.com/sourcegraph/self-serve-cody/pull/886 and run SSC
backend locally
- run Sourcegraoh instance in dotcom mode locally
- log in as a Cody Pro team admin and send an invite to another user
- log in as an invited user and follow the link from the email
- ensure link navigates to the "/cody/manage/" page and is hanled as
expected (see test plan from
https://github.com/sourcegraph/sourcegraph/pull/63231)
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
It seems many of our doc links for code hosts are broken in production
due to a url changed from external_services to code_hosts. I did a find
an replace to update all the ones I could find.
This fixes the alignment of the icons in the dynamic filters sidebar by
mvoing the icon out of the `label` span and directly under the section
item flexbox. I did this by creating an `icon` slot, which also allowed
me to simplify a bunch of other complex slot interactions.
A glob that doesn't match any files got introduced in
4077b3ec22 (diff-f7c1ab1acb5e753bccdd4b092b0098fa58855899e8764b68829ada2ba9cea760R147)
which appears to confuse Gazelle, leading to `sg bazel configure` not
updating ts files.
Fixes https://github.com/sourcegraph/devx-support/issues/1029
## Test plan
Locally tested:
1. Dropped the offending glob
2. rm'ed `client/web/src/cody/subscription/subscriptionSummary.ts`
3. `sg bazel configure`
4. Observed the build file being updated accordingly.
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
5. Add bullet list items for each additional detail you want to cover
(see example below)
6. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
7. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Currently queries are assumed to be 'literal', but in the current apps
we mostly use 'keyword' and 'standard'. Ideally we could pass the
pattern type that was used for each history entry, but we don't have
that information and cannot pass it easily.
Defaulting to the 'standard' or 'keyword' type is the next best option
to ensure that regex literal in the query are properly highlighted.
I defaulted to 'standard' in the React app because it's still possible
to opt out of keyword search.
Fixes bug intorduced in
https://github.com/sourcegraph/sourcegraph/pull/63231
Encode the URL search params added to `returnTo` search param value.
Previously the search param value hasn't been encoded resulting in URLs
with broken search params , e.g.
*"/sign-in?returnTo=/cody/manage?teamID=1&inviteID=2"* (note the second
"?" making the search params invalid).
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
- CI
- Tested manually:
- Make `signOutAndRedirectToSignIn` available in the window object, e.g.
`window.signOutAndRedirectToSignIn = signOutAndRedirectToSignIn` in the
*client/web/src/cody/management/api/react-query/callCodyProApi.ts*
- On "/cody/manage" page (any page works actually) ensure that a few
search params are added to the URL
- call `signOutAndRedirectToSignIn` in the browser console
- ensure you have been sign out, signed back in and the search params
are still in the URL
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Closes https://github.com/sourcegraph/sourcegraph/issues/63078
Part of https://github.com/sourcegraph/self-serve-cody/issues/804 (see
also its backend counterpart
https://github.com/sourcegraph/self-serve-cody/pull/858)
[Figma](https://www.figma.com/design/FMSdn1oKccJRHQPgf7053o/Cody-PLG-GA?node-id=4042-4927&t=Ob2UbemEkft4ofJZ-0)
### Summary
1. Moved the accept invite UI to the "/cody/manage" page.
2. Handled cases where the invited user is already a Cody Pro user.
3. Fixed styles in the CodyAlert component to ensure images are visible.
### Implementation Details
1. Added the `useInviteState` hook, which returns `initialInviteStatus`
and `initialUserStatus`.
We track the initial statuses to determine the appropriate UI variant to
display. For example, if the initial invite status is "sent" (indicating
the invite can be accepted) and the initial user status is
`UserInviteStatus.NoCurrentTeam` (indicating the user is not a member of
any team), a confirmation banner is shown for the user to accept or
decline the invite. After the user responds, the invite query is
invalidated, updating the status to "accepted", "canceled", or "errored"
based on their action. Depending on the result, a success or error
banner is displayed, or the banner is hidden if the invite is canceled.
More configuration examples can be found in the Screenshots section. All
possible states are detailed in the `AcceptInviteBannerContent`.
2. For users who are the sole admin of their current team, the banner is
shown on the "/cody/manage" page.
The design requires showing a banner on the "/cody/team/manage" page to
suggest transferring the admin role to another team member. However,
this page is not yet ready. To sync the banner state with user role
changes or deletion actions, the members list query must be invalidated
after each action. The current implementation of the "cody/manage/team"
page does not support refetching with the `useSSCQuery` hook. To resolve
this, we need to migrate the "cody/manage/team" page to use React Query
to allow query invalidation after each action. For now, users who are
sole admins see a banner on the "cody/manage" page suggesting
transferring the admin role, with a link to the "/cody/manage/team"
page.
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
### Screenshots
| Description | Screenshot |
|--|--|
| Failed to define user state OR invite status is not "sent" (thus can't
be accepted) | <img width="1516" alt="Screenshot 2024-06-14 at 14 39 41"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/cf712239-6a8e-4a66-a4a2-c1932ba70ffd">
|
| User is not on a Cody Pro team | <img width="1516" alt="Screenshot
2024-06-14 at 14 34 30"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/d6b53dc4-c7df-45eb-a743-9baddfdd8aa3"><img
width="1516" alt="Screenshot 2024-06-14 at 14 34 40"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/617957cf-8259-4056-a117-8b806ece6efe">|
|on the team they've been invited to|<img width="1516" alt="Screenshot
2024-06-14 at 14 35 41"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/eaa871ce-acd3-4a7e-a25c-74011a42af58">|
| User is the sole admin of another team |<img width="1516"
alt="Screenshot 2024-06-14 at 14 38 42"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/1382e5a0-4375-4002-93a4-ec25d354317f">|
| User is on another team |<img width="1516" alt="Screenshot 2024-06-14
at 14 36 38"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/2bf20073-f49b-4fb1-9996-6143671c1727"><img
width="1516" alt="Screenshot 2024-06-14 at 14 36 43"
src="https://github.com/sourcegraph/sourcegraph/assets/25318659/349e9445-b2ec-402d-ac0a-6b2517abde9c">|
## Test plan
- Checkout the branch from
https://github.com/sourcegraph/self-serve-cody/pull/858 and run SSC
locally
- Run Sourcegraph in dotcom mode
- As a Cody Pro team admin send invites to users that have different
statuses (are not on a team, are members of the team they were invited
to, are members of another team, are sole admins of their teams)
- As the invited user:
- click the invite link from the email
- modify the hostname in the URL so that it points to the local
Sourcegraph instance
- ensure the correct banner is displayed
- ensure user can accept/decline the invite (if applicable for the
banner type)
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
5. Add bullet list items for each additional detail you want to cover
(see example below)
6. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
7. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
This PR appends a trailing slash to org and directory suggestions so
that we don't search in repos or directories that are a prefix of the
current org/directory.
## Test plan
Manual testing.
This PR adds a new suggestions source to the repository search input. It
currently offers the following suggestions:
- Repository group/org (on every repo page)
- Current file and/or directory (on blob and tree pages)
- Language of current file (on blob pages)
When on a commit page it adds the revision of the commit to the repo
filter.
A new context store is introduced to propagate those values to the
search input. I also had to update our query processing logic to
preserve pattern and filter token ranges (first commit) so that we can
also replace filters, not just add the.
NOTE: I'm not convinced the way the information is propagated via
context is the best way to do, but it's the simplest I could think of
now. I can imagine in the future that individual pages create/register
suggestions directly.
https://github.com/sourcegraph/sourcegraph/assets/179026/7c1b78e3-061b-4dc8-a1ee-fb3273e633ba
## Test plan
Manual testing.
---------
Co-authored-by: Camden Cheek <camden@ccheek.com>
Closes srch-467
tl;dr: This commit switches all remaining mdi icons to lucide.
This commit does a couple of things to make the migration to lucide
icons and to the `Icon2` (now `Icon` again) component complete:
- Use lucide icons instead of mdi icons
- Turn custom icons back to SVG files and use `unplugin-icon`s custom
collections support to reference them
- Rename `Icon` component to `SVGIcon`. We still need it for integrating
with shared web app code.
- Rename `Icon2` component to `Icon`.
- Update to svelte@4.2.18 to [bring in a fix for
`<svelte:component`](https://github.com/sveltejs/svelte/releases/tag/svelte%404.2.12)
which is used by (now) `Icon`.
I put our generic icons in `assets/icons/` and the specific symbol icons
in `assets/symbol/icons`. They can be referenced via `ISgName` and
`ISymbolName`. I'm open to changes to the location and the naming.
If the same icon wasn't available in lucide I tried to find one that
made sense semantically. I expect we'll make another pass (in a separate
PR) to adjust icons and tweak icon sizes/colors.
## Test plan
`pnpm build` and svelte check
PR #49682 made some CSS changes to hide the caret as well as bracket
matching for this input. I assume that seeing those in a read-only input
was confusing.
However, hiding the textarea element also breaks copying the input's
value. Instead of hiding the textarea, we are now hiding the visiual
representation of the caret.
A noteable difference in behavior now is that it's possible to focus the
input via tab, but there is no visual indiciation that the editor has
focus (since we hide the caret, as before).
## Test plan
Manual tested on
https://sourcegraph.test:3443/site-admin/external-services/RXh0ZXJuYWxTZXJ2aWNlOjky
This adds Roboto Mono as the default monospace font for the Svelte
webapp. Previously, we were nominally using SF Mono, but that is not
installed by default and we were not fetching it, so the figma designs
looked different than what was being rendered in the web app. This uses
FontSource packages for the font for easy self-hosting (no external
requests).
Fixes srch-516
Using vite's inspect plugin I found out that we are importing a lot of
unnecessary components again, including `@sourcegraph/wildcard` and
`@sourcegraph/branded`.
By removing those dependencies we speed up the development build significantly.
## Test plan
`pnpm build`
Fixes the issues requiring the workaround described in [this
video](https://www.loom.com/share/10a4a66a19b548c7b0866fe2cc358daa).
Closes#60710
No more manual editing of `settings.json`.
The endpoint URL and access code can now all be managed from the UI
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
### First
Build and run locally.
```
git switch peterguy/vscode-sourcegraph-extension-fix-auth
cd client/vscode
pnpm run build
```
### Then
Launch extension in VSCode: open the `Run and Debug` sidebar view in VS
Code, then select `Launch VS Code Extension` from the dropdown menu.
Click on `Have an account?` to open the login dialog.
Enter an access token and the URL of the Sourcegraph instance to which
you would like to connect.
Click `Authenticate account`.
In the Help and Feedback section, click your username to open the logout
panel, then log out.
Repeat the login process.
You can check `settings.json` if you'd like to confirm that it's no
longer being used.
If you're logging in to dotcom, you'll probably se a SQL error. The
login process still works; the SQL error does not have long to live.
## Changelog
- Entering the URL and access token in the UI now works - no more manual
editing of `settings.json`
Closes SRCH-452
Until this commit both the React and Svelte apps have used the same code
to determine the correct file icon. That code however still held
separate logic for the two apps with the result that our file icon set
for the Svelte app was a lot smaller.
This commit separates the logic and now makes use of `unplugin-icons` in
the Svelte app.
I tried to use `unplugin-icons` in the React so that the code could
continued to be shared but I couldn't get it to work.
Note that I didn't use the exact same icons as in the React app. I
wanted to minimize the number of different icon sets we are using.
## Test plan
Builds without error, manual testing.
This adds `Inter` as the preferred for `--font-family-base` in the
Svelte webapp. Previously, we were using system fonts for our base font,
which meant our web app looked different depending on the OS+browser.
Instead of depending on the Google Fonts CDN, this uses Fontsource,
which let us easily self-host Google Fonts (and other OSS fonts) just by
importing an NPM package. No committing font files to git, and no
dependency or connection to a 3rd-party server. The font itself weighs
~40KB for the full, variable-weight font.
Contributes to SRCH-445
Adds support to the lang file filter for Magik language (`lang: Magik`).
In order to do that we add wrappers around go-enry and update search
code to use them. This provides flexibility for us in the future to
support other languages that are not in Linguist as well.
Closes SRCH-496
#63128 added a dedicated button for closing the bottom panel but
clicking the button didn't cause the diff view to close. This commit
fixes that.
## Test plan
Manual testing.
I disabled a few tests to get #62560 merged. This just goes back and fixes the ones I disabled. There are still a handful skipped, but the fixes were non-trivial.
This updates the `Popover` component to accept a passed-in target rather
than setting the target via an action. This allows us to pass in targets
not owned by the `Popover` component, which is important for things like
the file tree where the logical target is a wrapper around what the
consumer has access to.
Closes SRCH-450
This commit adds a button to the right hand side of the tabs that allows
closing the bottom panel.
For this I
- extended the Tabs.svelte component to allow rendering something to the
right hand side of the tabs.
- added a new `text` variant to button that renders an unstyled button
and shows a background on hover
Note that the icon as shown in the figma design doesn't exist in lucide.

## Test plan
Visual/manual inspection in light and dark mode
## Changelog
- Added bottom panel close button
- Added 'text' variant to Button component
- Added 'actions' slot to Tabs component
- Added Button component stories
Fixes SRCH-484. See that issue for more information about the problem.
Instead of hardcoding the routes that can contain file paths, I'm using
the generated list of routes in `routes.ts` and extract any route that
ends with a `[...path]` segment (which, so far at least, is used as the
file path parameter).
This list is then used to hook into the routing process and encode the
file path when any of the routes match. As mentioned in the `reroute`
documentation, this does not affect the URL displayed in the browser.
Because the file path is now URL encoded we need to decode it before we
can process it further (I grepped for all occurrences of `params.path`).
## Test plan
Manual testing, integration test.
This runs playwright tests with bazel. This changes how the
app is served in the tests, specifically playwright will intercept all
network calls to the local server and serve the static assets directly
or serve root index.html file if nothing is matched.
---------
Co-authored-by: bahrmichael <michael.bahr@sourcegraph.com>
Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
Co-authored-by: Michael Bahr <1830132+bahrmichael@users.noreply.github.com>
Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
Co-authored-by: Camden Cheek <camden@ccheek.com>
This modifies our pattern for shipping a svelte-enabled HTML document by
injecting the svelte-specific things into our primary `app.html` rather
than trying to make `app.prod.html` match the behavior of the frontend
`app.html`.
I could not figure out a "blessed" way to integrate this into the build
system, so I went for the hacky way: render `app.prod.html` in a format
that's easily parseable, then parse it in `frontend` and inject it into
our `app.html` with the standard go template patterns.
This one is straightforward: changing the spelling of a variable.
As I poked around in the vscode extension looking for what's going on
with the authentication errors, the misspelling of `scretTokenKey`
became difficult to ignore. So I fixed it. :-D
## Test plan
1. Build and run locally.
```
cd client/vscode
pmpn run build
```
2. Launch extension in VSCode: open the `Run and Debug` sidebar view in
VS Code, then select `Launch VS Code Extension` from the dropdown menu.
Verify expected behavior.
Sandbox escapes be-gone
## Test plan
Tested in CI and locally with `bazel build //client/...` as well as a
lot of blood, sweat n tears tearing through failed sandboxes
## Changelog
This applies the `sizeToFit` action to the file header, allowing us to
collapse the header in multiple steps:
- First, collapse the actions down to icons
- Next, collapse elements one by one from the front of the path and put
them in an overflow dropdown
CLOSE https://github.com/sourcegraph/cody-issues/issues/211 &
https://github.com/sourcegraph/cody-issues/issues/412 &
https://github.com/sourcegraph/cody-issues/issues/412
UNBLOCK https://github.com/sourcegraph/cody/pull/4360
* Add support for Google Gemini AI models as chat completions provider
* Add new `google` package to handle Google Generative AI client
* Update `client.go` and `codygateway.go` to handle the new Google
provider
* Set default models for chat, fast chat, and completions when Google is
the configured provider
* Add gemini-pro to the allowed list
<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
- How was it PREVIOUSLY.
- How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.
The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->
## Test plan
<!-- All pull requests REQUIRE a test plan:
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
For Enterprise instances using google as provider:
1. In your Soucegraph local instance's Site Config, add the following:
```
"accessToken": "REDACTED",
"chatModel": "gemini-1.5-pro-latest",
"provider": "google",
```
Note: You can get the accessToken for Gemini API in 1Password.
2. After saving the site config with the above change, run the following
curl command:
```
curl 'https://sourcegraph.test:3443/.api/completions/stream' -i \
-X POST \
-H 'authorization: token $LOCAL_INSTANCE_TOKEN' \
--data-raw '{"messages":[{"speaker":"human","text":"Who are you?"}],"maxTokensToSample":30,"temperature":0,"stopSequences":[],"timeoutMs":5000,"stream":true,"model":"gemini-1.5-pro-latest"}'
```
3. Expected Output:
```
❯ curl 'https://sourcegraph.test:3443/.api/completions/stream' -i \
-X POST \
-H 'authorization: token <REDACTED>' \
--data-raw '{"messages":[{"speaker":"human","text":"Who are you?"}],"maxTokensToSample":30,"temperature":0,"stopSequences":[],"timeoutMs":5000,"stream":true,"model":"gemini-1.5-pro-latest"}'
HTTP/2 200
access-control-allow-credentials: true
access-control-allow-origin:
alt-svc: h3=":3443"; ma=2592000
cache-control: no-cache
content-type: text/event-stream
date: Tue, 04 Jun 2024 05:45:33 GMT
server: Caddy
server: Caddy
vary: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, Cookie
x-accel-buffering: no
x-content-type-options: nosniff
x-frame-options: DENY
x-powered-by: Express
x-trace: d4b1f02a3e2882a3d52331335d217b03
x-trace-span: 728ec33860d3b5e6
x-trace-url: https://sourcegraph.test:3443/-/debug/jaeger/trace/d4b1f02a3e2882a3d52331335d217b03
x-xss-protection: 1; mode=block
event: completion
data: {"completion":"I","stopReason":"STOP"}
event: completion
data: {"completion":"I am a large language model, trained by Google. \n\nThink of me as","stopReason":"STOP"}
event: completion
data: {"completion":"I am a large language model, trained by Google. \n\nThink of me as a computer program that can understand and generate human-like text.","stopReason":"MAX_TOKENS"}
event: done
data: {}
```
Verified locally:

#### Before
Cody Gateway returns `no client known for upstream provider google`
```sh
curl -X 'POST' -d '{"messages":[{"speaker":"human","text":"Who are you?"}],"maxTokensToSample":30,"temperature":0,"stopSequences":[],"timeoutMs":5000,"stream":true,"model":"google/gemini-1.5-pro-latest"}' -H 'Accept: application/json' -H 'Authorization: token $YOUR_DOTCOM_TOKEN' -H 'Content-Type: application/json' 'https://sourcegraph.com/.api/completions/stream'
event: error
data: {"error":"no client known for upstream provider google"}
event: done
data: {
```
## Changelog
<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
5. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
6. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?
Audience: TS/CSE > Customers > Teammates (in that order).
Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->
<!--
Example:
Title: fix(search): parse quotes with the appropriate context
Changelog section:
## Changelog
- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
Added support for Google as an LLM provider for Cody, with the following
models available through Cody Gateway: Gemini Pro (`gemini-pro-latest`),
Gemini 1.5 Flash (`gemini-1.5-flash-latest`), and Gemini 1.5 Pro
(`gemini-1.5-pro-latest`).
* Bug fix: Stripe was called twice
* Split "individual" vs. "team" case for page title
* Use WhiteIcon for Cody logo
* Add customUI to CreateCheckoutSessionRequest
* Use custom Stripe checkout, matching Rob's designs
* Use debouncing
* Add "loading" states
* Redirect after successful payment (needs more fixes)
After the changes to the file tree layout in #62981, we can clean up the styles and DOM a bit. These changes are partially in prep for experimenting with alternative "current path" representations. Comments inline.
* Add search files quick actions for collapsed file sidebar
* Update tabs appearance
* Fix fuzzy finder appearance
* Fix fuzzy finder appearance [2]
* Add keyboard support for tabs
* Set a proper delays to opt in/out popover/tooltip
* Add close on escape hotkeys
* Add shortcuts to history and references panels
* Fix sidebar shadows problem
* Run prettier
* Simplify shortcuts keys
This PR fixes a bug in the site admin UI where we showed references to
embeddings even when they were disabled in site config.
In follow-up work, we plan to remove the embeddings logic completely.
Closes https://github.com/sourcegraph/cody-issues/issues/50
This PR adds the inline file search to the file view.
## Changelog
- Refactored the existing CodeMirror extension to allow UI customization
- Moved utility functions around to avoid loading all of wildcard into the prototype (which lead to build errors)
- Tweaked the new icon component to better align within buttons (I missed that in #62908 because I didn't test it within buttons)
- Noticed that button group styles didn't apply correctly and the reason seemed to be that we were mixing sveltekit and react styles. So I copied the button styles into the sveltekit app.
- Added a switch component, following https://web.dev/articles/building/a-switch-component .
This change adds support for the Google Gemini 1.5 Flash and Pro models in the ModelBadges component and the isAllowedCustomChatModel function. This allows these models to be displayed and used in the Sourcegraph product subscriptions UI and chat functionality.
This PR refactors a batch changes example that uses `patterntype:structural` to
use regex instead. We no longer expose `patterntype:structural` by default, and
want to push users towards other pattern types.
- Adds a hoverDelay parameter to Popover so each consumer doesn't need to do this manually
- Makes hovers only show when the mouse comes to rest
- Closes the popover when the window loses focus so we don't miss a mouseleave event and have popovers get stuck open
- Adds a delay to popover closing when the mouse leaves one of the target elements so there is room for error when moving the mouse from the trigger to the popover
- Adds preloading back to the file tree because the popover now does not create the element until the delay has passed
- Makes it so clicking the target closes the popover when hover is enabled.
This makes various tweaks and simplifications to the LastCommit component shown on the file page.
- Uses the Timestamp component
- Removes a bunch of unnecessary DOM elements and styles in favor of just using flexbox well
- Removes the max width on the last commit component, allowing it to take up as much space as is available (but leaving a healthy gap from the tabs). This was the primary reason I tackled this PR. Most commits I see are truncated to the "barely useful" level
See also #62904.
This PR adds a new icon component (`Icon2`), which takes an svg component imported by `unplugin-icons`. To make things easier the icons can be auto-imported via `unplugin-auto-import`.
Usage example:
```js
import Icon2 from '$lib/Icon2.svelte'
<Icon2 icon={ILucideX} inline />
```
`unplugin-icons` allows us to:
- use other icon sets besides lucide, while using the same API. Other icon sets are necessary for file icons. `react-icons`, which we use in the React app, also pulls from multiple icon sets.
- define our own icon sets
See https://github.com/unplugin/unplugin-icons for more information.
If it turns out that auto-importing (which involves generating TypeScrip types) doesn't work with our Bazel pipeline we can fall back to manual importing.
This PR converts some icons as example.
* Rename smartContext to smartContextWindow
* Update CHANGELOG.md
Co-authored-by: Kalan <51868853+kalanchan@users.noreply.github.com>
---------
Co-authored-by: Kalan <51868853+kalanchan@users.noreply.github.com>
Currently, all backend integration tests transitively depend on the client bundle. This results in rebuilds of the closure, and a (likely) cache miss on the test, when modifying any client-side files.
Given that the client bundle isnt needed for these tests, we can create targets that don't include the client bundle in its transitive closure, which should in theory improve the cache hit for backend integration tests by not having client side changes invalidate it. This would also be beneficial in local env, to keep frontend rebuilds down
To do this, we still need to create a `web.manifest.json` file due to some unfortunate requirement on that file existing as part of initializing the sourcegraph instance. For this I just create an empty json file, `select` this instead of the client bundle target in client/web/dist/BUILD.bazel based on a `//:integration_testing_enabled` config setting, and creating a `go_binary`-wrapping bazel rule + macro that automatically applies a transition to set this to true `go_binary_nobundle`, and using that rule for the specific `//cmd/{server,frontend}:{server,frontend}_nobundle` binary rules (along with the relevant `oci_{image,tarball}` etc rules to consume it).
## Test plan
- Integration tests in CI still work
- `bazel cquery 'kind("js_library", deps(//cmd/frontend:image_nobundle))'`, `bazel cquery 'kind("js_library", deps(//cmd/server:image_nobundle))'`, ``bazel cquery 'kind("js_library", deps(//testing:backend_integration_test))'` etc all return empty set
- Release test with marker in web bundle to ensure released images contain the web bundle via `sg release run test --version 5.4.2` (commenting out other tests for brevity)
* Add "welcome to Cody Pro" notification
* Trigger the notification in accept invitations
* Trigger the notification in signups
* Redirect to the correct page after accepting an invite
* Unrelated: Fix header style
This reverts commit e45c2ed.
We've decided to revert this behavior after receiving negative feedback from
several customers. Instead, we'll work to improve indexing speed and
reliability to minimize drift between search results and the file view.
This adds a link to the repository's code-graph page to the repo
navigation.
Additional changes:
- added a flag to each menu item that specifies whether
or not show the entry for non-admin users (defaults to `false`)
- updated vite's proxy configuration to properly load React repo pages
from the server
This adds a copy button to the file path in the file view, reduces spacing between path elements, and removes spaces from the the copied text for the file path.
This updates the history panel entries to allowing closing the diff and
commit view by clicking the same link again (i.e. the commit subject or
the 'view at commit' button).
This simply runs `pnpm format` and the LSPs formatter to format .svelte
files that have been recently added.
(we do not run the formatter for .svelte files in CI)
This makes each dir entry in the file popover header a link, and allows wrapping so the full path is always visible. Uses the same wrapping logic as the file header so the slashes work right. Additionally, it linkifies the commit message to point to the same page as the OID link
The repo popover has deployed to S2, but it's not visible to anyone who is not a site admin because one of the GraphQL fields used is restricted to only site admins.
This updates the query to use a non-restricted field, and also fixes the code host capitalization while I'm at it.
This re-applies #61989 after it was reverted. In addition to reapplying the change:
- It reverts the changes to Popover.svelte that removed the border.
- We only start loading data on hover, not on mount
- Various fixes in text overflow conditions
- Removes the language from the popover data because it can be very expensive to calculate
(another reason to pre-calculate language, but that's for another day)
- Moves the data loading out of the page loader. Exports the data loading function from
the component so data loading is still orchestrated by the caller. (I know this will be controversial, reasoning inline)
- Adds a delay to the popover so it doesn't get in the way as your mouse moves over the page.
- Uses the display name instead of the author name
- Linkifies the commit message
* Add config item, get it to the front end
* Use config on the front end
* Send team=1 if the team button is clicked
* Unrelated: Event logging cleanup
update: Remove A/B testing on web signup and keep on IDE signup
Co-authored-by: gitstart-sourcegraph <gitstart-sourcegraph@users.noreply.github.com>
Co-authored-by: GitStart-SourceGraph <89894075+gitstart-sourcegraph@users.noreply.github.com>
* Remove "open in new" icon
* Make "Add seats" button of the "success" type
* Add title
* Left-align "Send" button
* Remove unneeded filter
* Convert table to grid
* Fix copy
* Center align action buttons
* Update button type
* Fix copy
* Add red outline to textbox if erroneous
* Error replaces help text
* Use text-uppercase in ADMIN and INVITED labels
* Add Cody Pro REST API client library
* Expose REST API methods for Subscriptions
* Address PR feedback
* Address even more, great PR feedback
* Add unit tests
* Run 'sg lint', 'bazel run //:configure'
* Fix error from bad merge
* Lint
While looking into #62713 I stumbled upon two z-index issues. This
commit removes a bunch of z-index settings to simplifying layering.
- Instead of setting a z-index on the header to make the sidebar
navigation work, we can "portal" the sidebar to the end of the
document.
- Likewise the repo search input is portalled to ensure that it renders
above all other content.
* First run on file tree visual update
* Fix spacings and colors for the file tree items
* Fix spacing for nested levels
* Add "move to scope" feature to the file tree
* Fix go to the root repository and improve move to scope transition
* Add a comment about resetting the cache before go to the root
* Move root button to the first row
* Add fixes by PR review comments
* Fix fuzzy finder state
* Fix ts problems
* Fix width layout problem for deep nested items
- On the frontend:
- Added a new field named `search.displayLimit` to the User settings
- Started using the `search.displayLimit` value while performing stream search
- On the backend:
- No changes
---------
Co-authored-by: Stefan Hengl <stefan@sourcegraph.com>
We already cycle through results when pressing the "normal" Enter key.
This didn't work for the numpad enter key because `event.code` reports
`NumpadEnter`, not `Enter`. `event.key` returns the same value for both
keys.
This was adjusted in response to customer feedback.
This fixes an issue with Jupyter notebook rendering where the offset from the anchor can clip the left side of the header text. The issue is that we use margin-left: 1rem; to offset the anchor, but the anchor isn't guaranteed to be exactly 1rem wide. This makes the relationship explicit and adds a comment that those are linked.
This commit adds a first version of the fuzzy finder.
Supported features:
- Repos, symbols, files search
- Automatic scoping of files and symbol search to current repository
- Activting search modes via keyboard shortcuts
- Keyboard support
Not yet supported:
- "All" search
- Result counts
- Scope toggle (i.e. search all files even when inside repository)
- Full a11y support
Additional changes:
- Introduced separate tab headers component. In this case I wanted to
reuse the same panel/UI and only change the data source.
- Added a function for formatting keyboard shortcuts that work with our
hotkey implementation.
Follow up work:
- Cleanup and tweak sources (matching, ranking, etc)
- Design updates
- Work on "not yet supported" items
While working on #62494 I noticed that the file tree didn't work as
expected.
In particular, when being at the repo root and navigating to a file via
the fuzzy finder the file tree would switch to the parent directory,
just like as if the file was directly navigated to.
However, what should happen is that the tree expands all directories to
reveal the file, because the repo root is the top level directory and we
should always be showing the most top level directory that was visited.
The issue is that we are not properly detecting the repo root level (I
think we switched from using `'.'` to `''` at some point). To avoid this
problem I'm now using a constant instead.
I also changed how the tree entries are scrolled into view. The current
solution doesn't work for deeply nested entries because at the time the
scroll logic is invoked the entry hasn't been loaded yet.
By moving the logic to the node it can scroll itself into view when it's
available.
The waterfall loading nature of the file tree also became much more
apparent. We can avoid this by using making use of the `ancestors` field
but that needs to be done in a separate PR because that entails larger
changes.
Until now we've simply imported the global `base.scss` file, which in
turn imports a bunch of other files and defines global CSS classes. Many
(most?) of them are actually not used.
This commit reduces to the number of imported files to the ones that
contain styles that are used. My methodology was to inspect every
file that `base.scss` imports and find out whether it defines custom
properties (variables) or global classes. In some cases I extracted
variables into their own files.
Some changes in text size made it obvious that we were not correctly centering the badge number. This fixes it by adding display: contents to the wrapping span that is just used for targeting an override. This way, the flexbox aligns items centered as intended.
Co-authored-by: Felix Kling <felix@felix-kling.de>