Skip to content
Merged
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
34 changes: 3 additions & 31 deletions static/app/components/events/autofix/autofixDiff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {DIFF_COLORS} from 'sentry/components/splitDiff';
import {IconChevron, IconClose, IconDelete, IconEdit} from 'sentry/icons';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {getPrismLanguage} from 'sentry/utils/prism';
import {useMutation, useQueryClient} from 'sentry/utils/queryClient';
import useApi from 'sentry/utils/useApi';
import useOrganization from 'sentry/utils/useOrganization';
Expand Down Expand Up @@ -85,37 +86,8 @@ function detectLanguageFromPath(filePath: string): string {
return 'plaintext';
}

// Map common file extensions to Prism language identifiers
const extensionMap: Record<string, string> = {
js: 'javascript',
jsx: 'jsx',
ts: 'typescript',
tsx: 'tsx',
py: 'python',
rb: 'ruby',
go: 'go',
java: 'java',
php: 'php',
c: 'c',
cpp: 'cpp',
cs: 'csharp',
html: 'html',
css: 'css',
scss: 'scss',
json: 'json',
md: 'markdown',
yaml: 'yaml',
yml: 'yaml',
sh: 'bash',
bash: 'bash',
rs: 'rust',
swift: 'swift',
kt: 'kotlin',
sql: 'sql',
xml: 'xml',
};

return extensionMap[extension] || 'plaintext';
const language = getPrismLanguage(extension);
return language || 'plaintext';
}

const SyntaxHighlightedCode = styled('div')`
Expand Down
Loading