mirror of
https://github.com/nushell/nushell
synced 2024-11-10 23:24:14 +00:00
try to match most of nushell syntax coloring (#323)
This commit is contained in:
parent
75cfee28b2
commit
f5b20f0e3b
1 changed files with 42 additions and 15 deletions
|
@ -38,12 +38,18 @@ impl Highlighter for NuHighlighter {
|
||||||
match shape.1 {
|
match shape.1 {
|
||||||
FlatShape::Custom(..) => output.push((Style::new().bold(), next_token)),
|
FlatShape::Custom(..) => output.push((Style::new().bold(), next_token)),
|
||||||
FlatShape::External => {
|
FlatShape::External => {
|
||||||
output.push((Style::new().fg(nu_ansi_term::Color::Green), next_token))
|
// nushell ExternalCommand
|
||||||
|
output.push((Style::new().fg(nu_ansi_term::Color::Cyan), next_token))
|
||||||
}
|
}
|
||||||
FlatShape::ExternalArg => {
|
FlatShape::ExternalArg => {
|
||||||
output.push((Style::new().fg(nu_ansi_term::Color::Green), next_token))
|
// nushell ExternalWord
|
||||||
|
output.push((
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Green).bold(),
|
||||||
|
next_token,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
FlatShape::Garbage => output.push((
|
FlatShape::Garbage => output.push((
|
||||||
|
// nushell Garbage
|
||||||
Style::new()
|
Style::new()
|
||||||
.fg(nu_ansi_term::Color::White)
|
.fg(nu_ansi_term::Color::White)
|
||||||
.on(nu_ansi_term::Color::Red)
|
.on(nu_ansi_term::Color::Red)
|
||||||
|
@ -51,50 +57,71 @@ impl Highlighter for NuHighlighter {
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
FlatShape::InternalCall => output.push((
|
FlatShape::InternalCall => output.push((
|
||||||
Style::new().fg(nu_ansi_term::Color::LightBlue).bold(),
|
// nushell InternalCommand
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Cyan).bold(),
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
FlatShape::Int => {
|
FlatShape::Int => {
|
||||||
output.push((Style::new().fg(nu_ansi_term::Color::Green), next_token))
|
// nushell Int
|
||||||
|
output.push((
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Purple).bold(),
|
||||||
|
next_token,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
FlatShape::Float => {
|
FlatShape::Float => {
|
||||||
output.push((Style::new().fg(nu_ansi_term::Color::Green), next_token))
|
// nushell Decimal
|
||||||
|
output.push((
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Purple).bold(),
|
||||||
|
next_token,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
FlatShape::Range => output.push((
|
FlatShape::Range => output.push((
|
||||||
Style::new().fg(nu_ansi_term::Color::LightPurple),
|
// nushell DotDot ?
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Yellow).bold(),
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
FlatShape::Bool => {
|
FlatShape::Bool => {
|
||||||
|
// nushell ?
|
||||||
output.push((Style::new().fg(nu_ansi_term::Color::LightCyan), next_token))
|
output.push((Style::new().fg(nu_ansi_term::Color::LightCyan), next_token))
|
||||||
}
|
}
|
||||||
FlatShape::Literal => {
|
FlatShape::Literal => {
|
||||||
|
// nushell ?
|
||||||
output.push((Style::new().fg(nu_ansi_term::Color::Blue), next_token))
|
output.push((Style::new().fg(nu_ansi_term::Color::Blue), next_token))
|
||||||
}
|
}
|
||||||
FlatShape::Operator => output.push((
|
FlatShape::Operator => output.push((
|
||||||
Style::new().fg(nu_ansi_term::Color::LightPurple).bold(),
|
// nushell Operator
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Yellow),
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
FlatShape::Signature => output.push((
|
FlatShape::Signature => output.push((
|
||||||
|
// nushell ?
|
||||||
Style::new().fg(nu_ansi_term::Color::Green).bold(),
|
Style::new().fg(nu_ansi_term::Color::Green).bold(),
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
FlatShape::String => output.push((
|
FlatShape::String => {
|
||||||
Style::new().fg(nu_ansi_term::Color::Yellow).bold(),
|
// nushell String
|
||||||
next_token,
|
output.push((Style::new().fg(nu_ansi_term::Color::Green), next_token))
|
||||||
)),
|
}
|
||||||
FlatShape::Flag => {
|
FlatShape::Flag => {
|
||||||
output.push((Style::new().fg(nu_ansi_term::Color::Yellow), next_token))
|
// nushell Flag
|
||||||
|
output.push((
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Blue).bold(),
|
||||||
|
next_token,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
FlatShape::Filepath => output.push((
|
FlatShape::Filepath => output.push((
|
||||||
Style::new().fg(nu_ansi_term::Color::Yellow).bold(),
|
// nushell Path
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Cyan),
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
FlatShape::GlobPattern => output.push((
|
FlatShape::GlobPattern => output.push((
|
||||||
Style::new().fg(nu_ansi_term::Color::Yellow).bold(),
|
// nushell GlobPattern
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Cyan).bold(),
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
FlatShape::Variable => output.push((
|
FlatShape::Variable => output.push((
|
||||||
Style::new().fg(nu_ansi_term::Color::Blue).bold(),
|
// nushell Variable
|
||||||
|
Style::new().fg(nu_ansi_term::Color::Purple),
|
||||||
next_token,
|
next_token,
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue