mirror of
https://github.com/harness/drone.git
synced 2025-05-17 01:20:13 +08:00
Treat file without extension as text + more syntax highlighted mapping (#708)
This commit is contained in:
parent
16a6a73e80
commit
3c83ecb0df
@ -68,8 +68,12 @@ export function useFileContentViewerDecision({
|
||||
SpecialTextFiles.find(name => name.toLowerCase() === filename?.toLowerCase()) ||
|
||||
TextExtensions.includes(extension.toLowerCase()) ||
|
||||
isSymlink ||
|
||||
isSubmodule
|
||||
isSubmodule ||
|
||||
!extension ||
|
||||
extension === filename ||
|
||||
'.' + extension === filename
|
||||
)
|
||||
|
||||
const category = isMarkdown
|
||||
? FileCategory.MARKDOWN
|
||||
: isSVG
|
||||
@ -155,6 +159,7 @@ const TextExtensions = [
|
||||
'bat',
|
||||
'bbcolors',
|
||||
'bcp',
|
||||
'bazel',
|
||||
'bdsgroup',
|
||||
'bdsproj',
|
||||
'bib',
|
||||
@ -473,7 +478,9 @@ const TextExtensions = [
|
||||
'uot',
|
||||
'ahk',
|
||||
'asciidoc',
|
||||
'slk'
|
||||
'slk',
|
||||
'env',
|
||||
'alpine'
|
||||
]
|
||||
|
||||
const SpecialTextFiles = [
|
||||
|
@ -296,14 +296,20 @@ const MONACO_SUPPORTED_LANGUAGES = [
|
||||
'yaml'
|
||||
]
|
||||
|
||||
// Some of the below languages are mapped to Monaco's built-in supported languages
|
||||
// due to their similarity. We'll still need to get native support for them at
|
||||
// some point.
|
||||
const EXTENSION_TO_LANG: Record<string, string> = {
|
||||
tsx: 'typescript',
|
||||
jsx: 'typescript',
|
||||
cc: 'cpp',
|
||||
env: 'shell',
|
||||
Makefile: 'shell',
|
||||
makefile: 'shell',
|
||||
gitignore: 'shell',
|
||||
toml: 'ini'
|
||||
toml: 'ini',
|
||||
bazel: 'python',
|
||||
workspace: 'python',
|
||||
alpine: 'dockerfile'
|
||||
}
|
||||
|
||||
export const PLAIN_TEXT = 'plaintext'
|
||||
|
Loading…
Reference in New Issue
Block a user