mirror of
https://github.com/harness/drone.git
synced 2025-05-17 09:30:00 +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()) ||
|
SpecialTextFiles.find(name => name.toLowerCase() === filename?.toLowerCase()) ||
|
||||||
TextExtensions.includes(extension.toLowerCase()) ||
|
TextExtensions.includes(extension.toLowerCase()) ||
|
||||||
isSymlink ||
|
isSymlink ||
|
||||||
isSubmodule
|
isSubmodule ||
|
||||||
|
!extension ||
|
||||||
|
extension === filename ||
|
||||||
|
'.' + extension === filename
|
||||||
)
|
)
|
||||||
|
|
||||||
const category = isMarkdown
|
const category = isMarkdown
|
||||||
? FileCategory.MARKDOWN
|
? FileCategory.MARKDOWN
|
||||||
: isSVG
|
: isSVG
|
||||||
@ -155,6 +159,7 @@ const TextExtensions = [
|
|||||||
'bat',
|
'bat',
|
||||||
'bbcolors',
|
'bbcolors',
|
||||||
'bcp',
|
'bcp',
|
||||||
|
'bazel',
|
||||||
'bdsgroup',
|
'bdsgroup',
|
||||||
'bdsproj',
|
'bdsproj',
|
||||||
'bib',
|
'bib',
|
||||||
@ -473,7 +478,9 @@ const TextExtensions = [
|
|||||||
'uot',
|
'uot',
|
||||||
'ahk',
|
'ahk',
|
||||||
'asciidoc',
|
'asciidoc',
|
||||||
'slk'
|
'slk',
|
||||||
|
'env',
|
||||||
|
'alpine'
|
||||||
]
|
]
|
||||||
|
|
||||||
const SpecialTextFiles = [
|
const SpecialTextFiles = [
|
||||||
|
@ -296,14 +296,20 @@ const MONACO_SUPPORTED_LANGUAGES = [
|
|||||||
'yaml'
|
'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> = {
|
const EXTENSION_TO_LANG: Record<string, string> = {
|
||||||
tsx: 'typescript',
|
tsx: 'typescript',
|
||||||
jsx: 'typescript',
|
jsx: 'typescript',
|
||||||
cc: 'cpp',
|
cc: 'cpp',
|
||||||
env: 'shell',
|
env: 'shell',
|
||||||
Makefile: 'shell',
|
makefile: 'shell',
|
||||||
gitignore: 'shell',
|
gitignore: 'shell',
|
||||||
toml: 'ini'
|
toml: 'ini',
|
||||||
|
bazel: 'python',
|
||||||
|
workspace: 'python',
|
||||||
|
alpine: 'dockerfile'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PLAIN_TEXT = 'plaintext'
|
export const PLAIN_TEXT = 'plaintext'
|
||||||
|
Loading…
Reference in New Issue
Block a user