Files
windmill/frontend/src/lib/components/copilot/chat/toolCodeDiffLanguage.ts
T
GuilhemandClaude Opus 5.5 1de54eeea4 feat(ai-chat): show native script edit diffs (#11278)
* feat(ai-chat): show native script edit diffs

* fix: render streamed edit diffs

* fix: render in-editor script edit diffs

* style: soften diff context separators

* fix: render full script update diffs

* fix: support empty script diffs

* fix: bound streamed tool diffs

* fix: preserve trailing diff context

* fix: defer collapsed tool diffs

* fix: retain full-code streaming previews

* fix: preserve created script diffs

* fix: disambiguate collapsed diff keys

* fix: render final newline diffs

* fix: preserve multiline diff highlighting

* fix: highlight diff sides as complete sources

* fix: bound completed tool diffs

* fix: diff large completed tool edits

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: bound tool diff rendering

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: bound tool diff highlighting and expand omitted rows

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: reveal omitted diff rows in chunks and bound long-line highlighting

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: collapse written scripts, skip empty diff bodies and fit line numbers

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: keep whole-file tool diffs collapsed while running

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: classify whole-file tool calls by argument shape

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: reopen failed diff cards and keep empty streamed replacements

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 15:44:40 +02:00

44 lines
1.3 KiB
TypeScript

import { csharp, go, java, json, plaintext, type LanguageType } from 'svelte-highlight/languages'
import graphql from 'svelte-highlight/languages/graphql'
import javascript from 'svelte-highlight/languages/javascript'
import php from 'svelte-highlight/languages/php'
import python from 'svelte-highlight/languages/python'
import powershell from 'svelte-highlight/languages/powershell'
import r from 'svelte-highlight/languages/r'
import ruby from 'svelte-highlight/languages/ruby'
import rust from 'svelte-highlight/languages/rust'
import shell from 'svelte-highlight/languages/shell'
import sql from 'svelte-highlight/languages/sql'
import typescript from 'svelte-highlight/languages/typescript'
import yaml from 'svelte-highlight/languages/yaml'
// Keyed by the editor language `scriptLangToEditorLang` returns, not the script language.
// for related places search: ADD_NEW_LANG
const LANGUAGE_BY_MONACO: Record<string, LanguageType<string>> = {
typescript,
javascript,
python,
json,
yaml,
sql,
shell,
powershell,
php,
rust,
graphql,
csharp,
nu: python,
java,
r,
go,
ruby,
text: plaintext,
plaintext
}
export const TOOL_CODE_DIFF_LANGUAGES = Object.keys(LANGUAGE_BY_MONACO)
export function toolCodeDiffLanguage(language: string): LanguageType<string> {
return LANGUAGE_BY_MONACO[language] ?? plaintext
}