Skip to content

Commit

Permalink
feat: add shellsession grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
mashehu committed Jun 13, 2023
1 parent 2bc97e5 commit e7ea3e5
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ export type Lang =
| 'scheme'
| 'scss'
| 'shaderlab' | 'shader'
| 'shellscript' | 'bash' | 'console' | 'sh' | 'shell' | 'zsh'
| 'shellscript' | 'bash' | 'sh' | 'shell' | 'zsh'
| 'shellsession' | 'console'
| 'smalltalk'
| 'solidity'
| 'sparql'
Expand Down
30 changes: 30 additions & 0 deletions packages/shiki/languages/shellsession.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "shellsession",
"scopeName": "text.shell-session",
"patterns": [
{
"match": "(?x) ^ (?: ( (?:\\(\\S+\\)\\s*)? (?: sh\\S*? | \\w+\\S+[@:]\\S+(?:\\s+\\S+)? | \\[\\S+?[@:][^\\n]+?\\].*? ) ) \\s* )? ( [>$#%❯➜] | \\p{Greek} ) \\s+ (.*) $",
"captures": {
"1": {
"name": "entity.other.prompt-prefix.shell-session"
},
"2": {
"name": "punctuation.separator.prompt.shell-session"
},
"3": {
"name": "source.shell",
"patterns": [
{
"include": "source.shell"
}
]
}
}
},
{
"name": "meta.output.shell-session",
"match": "^.+$"
}
],
"fileTypes": ["sh-session"]
}
16 changes: 13 additions & 3 deletions packages/shiki/src/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ export type Lang =
| 'scheme'
| 'scss'
| 'shaderlab' | 'shader'
| 'shellscript' | 'bash' | 'console' | 'sh' | 'shell' | 'zsh'
| 'shellscript' | 'bash' | 'sh' | 'shell' | 'zsh'
| 'shellsession' | 'console'
| 'smalltalk'
| 'solidity'
| 'sparql'
Expand Down Expand Up @@ -808,6 +809,7 @@ export const languages: ILanguageRegistration[] = [
scopeName: 'text.marko',
path: 'marko.tmLanguage.json',
displayName: 'Marko',
samplePath: 'marko.sample',
embeddedLangs: ['css', 'less', 'scss', 'javascript']
},
{
Expand All @@ -821,7 +823,7 @@ export const languages: ILanguageRegistration[] = [
scopeName: 'source.mdx',
path: 'mdx.tmLanguage.json',
displayName: 'MDX',
embeddedLangs: ['tsx', 'toml', 'yaml', 'c', 'clojure', 'coffee', 'cpp', 'csharp', 'css', 'diff', 'docker', 'elixir', 'elm', 'erlang', 'go', 'graphql', 'haskell', 'html', 'ini', 'java', 'javascript', 'json', 'julia', 'kotlin', 'less', 'lua', 'make', 'markdown', 'objective-c', 'perl', 'python', 'r', 'ruby', 'rust', 'scala', 'scss', 'shellscript', 'sql', 'xml', 'swift', 'typescript']
embeddedLangs: ['tsx', 'toml', 'yaml', 'c', 'clojure', 'coffee', 'cpp', 'csharp', 'css', 'diff', 'docker', 'elixir', 'elm', 'erlang', 'go', 'graphql', 'haskell', 'html', 'ini', 'java', 'javascript', 'json', 'julia', 'kotlin', 'less', 'lua', 'make', 'markdown', 'objective-c', 'perl', 'python', 'r', 'ruby', 'rust', 'scala', 'scss', 'shellscript', 'shellsession', 'sql', 'xml', 'swift', 'typescript']
},
{
id: 'mermaid',
Expand Down Expand Up @@ -1078,7 +1080,15 @@ export const languages: ILanguageRegistration[] = [
scopeName: 'source.shell',
path: 'shellscript.tmLanguage.json',
displayName: 'Shell',
aliases: ['bash', 'console', 'sh', 'shell', 'zsh']
aliases: ['bash', 'sh', 'shell', 'zsh']
},
{
id: 'shellsession',
scopeName: 'text.shell-session',
path: 'shellsession.tmLanguage.json',
displayName: 'Shell Session',
aliases: ['console'],
embeddedLangs: ['shellscript']
},
{
id: 'smalltalk',
Expand Down
4 changes: 3 additions & 1 deletion scripts/grammarSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export const githubGrammarSources: [string, string][] = [
'https://github.com/scala/vscode-scala-syntax/blob/master/syntaxes/Scala.tmLanguage.json'
],
['scheme', 'https://github.com/sjhuangx/vscode-scheme/blob/master/syntaxes/scheme.tmLanguage'],
['shellsession', 'https://github.com/hronro/sublime-linguist-syntax/blob/master/syntaxes/ShellSession.tmLanguage'],
[
'smalltalk',
'https://github.com/leocamello/vscode-smalltalk/blob/master/syntaxes/smalltalk.tmLanguage.json'
Expand Down Expand Up @@ -358,7 +359,8 @@ export const languageAliases = {
rust: ['rs'],
'html-ruby-erb': ['erb'],
shaderlab: ['shader'],
shellscript: ['bash', 'console', 'sh', 'shell', 'zsh'],
shellscript: ['bash', 'sh', 'shell', 'zsh'],
shellsession: ['console'],
stylus: ['styl'],
typescript: ['ts'],
vb: ['cmd'],
Expand Down

0 comments on commit e7ea3e5

Please sign in to comment.