Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fixed memory leak attributed to CodeMirror allocating objects on heap that were never freed. [#1580](https://github.com/sourcebot-dev/sourcebot/pull/1580)

## [5.1.7] - 2026-08-13

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, test } from 'vitest';
import { zoekt } from './zoektLanguageExtension';

test('reuses the same language support across calls', () => {
expect(zoekt()).toBe(zoekt());
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { LanguageSupport, StreamLanguage } from "@codemirror/language";
import { tags as t } from "@lezer/highlight";

export const zoekt = () => {
// StreamLanguage permanently registers a document NodeType, so this must be a
// module singleton rather than one instance per SearchBar render.
const zoektLanguageSupport = (() => {
const zoektLanguage = StreamLanguage.define({
startState() {
return {
Expand Down Expand Up @@ -75,4 +77,6 @@ export const zoekt = () => {
});

return new LanguageSupport(zoektLanguage);
};
})();

export const zoekt = () => zoektLanguageSupport;
Loading