summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-ide/src/complete.rs12
-rw-r--r--crates/typst-ide/src/tooltip.rs2
-rw-r--r--crates/typst-syntax/src/ast.rs4
-rw-r--r--crates/typst-syntax/src/highlight.rs12
-rw-r--r--crates/typst-syntax/src/kind.rs6
-rw-r--r--crates/typst-syntax/src/lexer.rs4
-rw-r--r--crates/typst-syntax/src/parser.rs6
-rw-r--r--crates/typst-syntax/src/reparser.rs4
-rw-r--r--crates/typst/src/eval/mod.rs2
-rw-r--r--crates/typst/src/geom/color.rs6
10 files changed, 29 insertions, 29 deletions
diff --git a/crates/typst-ide/src/complete.rs b/crates/typst-ide/src/complete.rs
index bb17dd37..5da22f45 100644
--- a/crates/typst-ide/src/complete.rs
+++ b/crates/typst-ide/src/complete.rs
@@ -97,7 +97,7 @@ fn complete_markup(ctx: &mut CompletionContext) -> bool {
}
// Start of an interpolated identifier: "#|".
- if ctx.leaf.kind() == SyntaxKind::Hashtag {
+ if ctx.leaf.kind() == SyntaxKind::Hash {
ctx.from = ctx.cursor;
code_completions(ctx, true);
return true;
@@ -268,7 +268,7 @@ fn complete_math(ctx: &mut CompletionContext) -> bool {
}
// Start of an interpolated identifier: "#|".
- if ctx.leaf.kind() == SyntaxKind::Hashtag {
+ if ctx.leaf.kind() == SyntaxKind::Hash {
ctx.from = ctx.cursor;
code_completions(ctx, true);
return true;
@@ -326,7 +326,7 @@ fn complete_field_accesses(ctx: &mut CompletionContext) -> bool {
if let Some(prev) = ctx.leaf.prev_sibling();
if prev.is::<ast::Expr>();
if prev.parent_kind() != Some(SyntaxKind::Markup) ||
- prev.prev_sibling_kind() == Some(SyntaxKind::Hashtag);
+ prev.prev_sibling_kind() == Some(SyntaxKind::Hash);
if let Some(value) = analyze_expr(ctx.world, &prev).into_iter().next();
then {
ctx.from = ctx.cursor;
@@ -796,8 +796,8 @@ fn complete_code(ctx: &mut CompletionContext) -> bool {
/// Add completions for expression snippets.
#[rustfmt::skip]
-fn code_completions(ctx: &mut CompletionContext, hashtag: bool) {
- ctx.scope_completions(true, |value| !hashtag || {
+fn code_completions(ctx: &mut CompletionContext, hash: bool) {
+ ctx.scope_completions(true, |value| !hash || {
matches!(value, Value::Symbol(_) | Value::Func(_) | Value::Type(_) | Value::Module(_))
});
@@ -933,7 +933,7 @@ fn code_completions(ctx: &mut CompletionContext, hashtag: bool) {
"Creates a mapping from names to value.",
);
- if !hashtag {
+ if !hash {
ctx.snippet_completion(
"function",
"(${params}) => ${output}",
diff --git a/crates/typst-ide/src/tooltip.rs b/crates/typst-ide/src/tooltip.rs
index 37f32e22..9629462b 100644
--- a/crates/typst-ide/src/tooltip.rs
+++ b/crates/typst-ide/src/tooltip.rs
@@ -49,7 +49,7 @@ fn expr_tooltip(world: &dyn World, leaf: &LinkedNode) -> Option<Tooltip> {
}
let expr = ancestor.cast::<ast::Expr>()?;
- if !expr.hashtag() && !matches!(expr, ast::Expr::MathIdent(_)) {
+ if !expr.hash() && !matches!(expr, ast::Expr::MathIdent(_)) {
return None;
}
diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs
index 447903c5..83e4ff9c 100644
--- a/crates/typst-syntax/src/ast.rs
+++ b/crates/typst-syntax/src/ast.rs
@@ -339,8 +339,8 @@ impl<'a> AstNode<'a> for Expr<'a> {
}
impl Expr<'_> {
- /// Can this expression be embedded into markup with a hashtag?
- pub fn hashtag(self) -> bool {
+ /// Can this expression be embedded into markup with a hash?
+ pub fn hash(self) -> bool {
matches!(
self,
Self::Ident(_)
diff --git a/crates/typst-syntax/src/highlight.rs b/crates/typst-syntax/src/highlight.rs
index e8ae613b..b77af922 100644
--- a/crates/typst-syntax/src/highlight.rs
+++ b/crates/typst-syntax/src/highlight.rs
@@ -174,7 +174,7 @@ pub fn highlight(node: &LinkedNode) -> Option<Tag> {
SyntaxKind::MathRoot => None,
SyntaxKind::MathPrimes => None,
- SyntaxKind::Hashtag => highlight_hashtag(node),
+ SyntaxKind::Hash => highlight_hash(node),
SyntaxKind::LeftBrace => Some(Tag::Punctuation),
SyntaxKind::RightBrace => Some(Tag::Punctuation),
SyntaxKind::LeftBracket => Some(Tag::Punctuation),
@@ -322,8 +322,8 @@ fn highlight_ident(node: &LinkedNode) -> Option<Tag> {
return Some(Tag::Function);
}
- // Are we (or an ancestor field access) directly after a hashtag.
- if ancestor.prev_leaf().map(|leaf| leaf.kind()) == Some(SyntaxKind::Hashtag) {
+ // Are we (or an ancestor field access) directly after a hash.
+ if ancestor.prev_leaf().map(|leaf| leaf.kind()) == Some(SyntaxKind::Hash) {
return Some(Tag::Interpolated);
}
@@ -339,11 +339,11 @@ fn highlight_ident(node: &LinkedNode) -> Option<Tag> {
None
}
-/// Highlight a hashtag based on context.
-fn highlight_hashtag(node: &LinkedNode) -> Option<Tag> {
+/// Highlight a hash based on context.
+fn highlight_hash(node: &LinkedNode) -> Option<Tag> {
let next = node.next_sibling()?;
let expr = next.cast::<ast::Expr>()?;
- if !expr.hashtag() {
+ if !expr.hash() {
return None;
}
highlight(&next.leftmost_leaf()?)
diff --git a/crates/typst-syntax/src/kind.rs b/crates/typst-syntax/src/kind.rs
index 669ca0f2..40a2855d 100644
--- a/crates/typst-syntax/src/kind.rs
+++ b/crates/typst-syntax/src/kind.rs
@@ -72,8 +72,8 @@ pub enum SyntaxKind {
/// A root in math: `√x`, `∛x` or `∜x`.
MathRoot,
- /// A hashtag that switches into code mode: `#`.
- Hashtag,
+ /// A hash that switches into code mode: `#`.
+ Hash,
/// A left curly brace, starting a code block: `{`.
LeftBrace,
/// A right curly brace, terminating a code block: `}`.
@@ -385,7 +385,7 @@ impl SyntaxKind {
Self::MathFrac => "math fraction",
Self::MathRoot => "math root",
Self::MathPrimes => "math primes",
- Self::Hashtag => "hashtag",
+ Self::Hash => "hash",
Self::LeftBrace => "opening brace",
Self::RightBrace => "closing brace",
Self::LeftBracket => "opening bracket",
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs
index 509f5d73..18622154 100644
--- a/crates/typst-syntax/src/lexer.rs
+++ b/crates/typst-syntax/src/lexer.rs
@@ -175,7 +175,7 @@ impl Lexer<'_> {
'*' if !self.in_word() => SyntaxKind::Star,
'_' if !self.in_word() => SyntaxKind::Underscore,
- '#' => SyntaxKind::Hashtag,
+ '#' => SyntaxKind::Hash,
'[' => SyntaxKind::LeftBracket,
']' => SyntaxKind::RightBracket,
'\'' => SyntaxKind::SmartQuote,
@@ -425,7 +425,7 @@ impl Lexer<'_> {
'~' if self.s.eat_if('>') => SyntaxKind::Shorthand,
'*' | '-' => SyntaxKind::Shorthand,
- '#' => SyntaxKind::Hashtag,
+ '#' => SyntaxKind::Hash,
'_' => SyntaxKind::Underscore,
'$' => SyntaxKind::Dollar,
'/' => SyntaxKind::Slash,
diff --git a/crates/typst-syntax/src/parser.rs b/crates/typst-syntax/src/parser.rs
index bd184b90..0cc733e6 100644
--- a/crates/typst-syntax/src/parser.rs
+++ b/crates/typst-syntax/src/parser.rs
@@ -117,7 +117,7 @@ fn markup_expr(p: &mut Parser, at_start: &mut bool) {
| SyntaxKind::Link
| SyntaxKind::Label => p.eat(),
- SyntaxKind::Hashtag => embedded_code_expr(p),
+ SyntaxKind::Hash => embedded_code_expr(p),
SyntaxKind::Star => strong(p),
SyntaxKind::Underscore => emph(p),
SyntaxKind::HeadingMarker if *at_start => heading(p),
@@ -254,7 +254,7 @@ fn math_expr_prec(p: &mut Parser, min_prec: usize, stop: SyntaxKind) {
let m = p.marker();
let mut continuable = false;
match p.current() {
- SyntaxKind::Hashtag => embedded_code_expr(p),
+ SyntaxKind::Hash => embedded_code_expr(p),
SyntaxKind::MathIdent => {
continuable = true;
p.eat();
@@ -595,7 +595,7 @@ fn code_expr_or_pattern(p: &mut Parser) {
fn embedded_code_expr(p: &mut Parser) {
p.enter_newline_mode(NewlineMode::Stop);
p.enter(LexMode::Code);
- p.assert(SyntaxKind::Hashtag);
+ p.assert(SyntaxKind::Hash);
p.unskip();
let stmt = matches!(
diff --git a/crates/typst-syntax/src/reparser.rs b/crates/typst-syntax/src/reparser.rs
index e03e1619..f7f89a3f 100644
--- a/crates/typst-syntax/src/reparser.rs
+++ b/crates/typst-syntax/src/reparser.rs
@@ -125,8 +125,8 @@ fn try_reparse(
end += 1;
}
- // Also take hashtag.
- if start > 0 && children[start - 1].kind() == SyntaxKind::Hashtag {
+ // Also take hash.
+ if start > 0 && children[start - 1].kind() == SyntaxKind::Hash {
start -= 1;
}
diff --git a/crates/typst/src/eval/mod.rs b/crates/typst/src/eval/mod.rs
index 8627b489..b6dbace9 100644
--- a/crates/typst/src/eval/mod.rs
+++ b/crates/typst/src/eval/mod.rs
@@ -223,7 +223,7 @@ pub fn eval_string(
/// In which mode to evaluate a string.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Cast)]
pub enum EvalMode {
- /// Evaluate as code, as after a hashtag.
+ /// Evaluate as code, as after a hash.
Code,
/// Evaluate as markup, like in a Typst file.
Markup,
diff --git a/crates/typst/src/geom/color.rs b/crates/typst/src/geom/color.rs
index a5b90aa3..a6d2135f 100644
--- a/crates/typst/src/geom/color.rs
+++ b/crates/typst/src/geom/color.rs
@@ -453,7 +453,7 @@ impl Color {
/// The color in hexadecimal notation.
///
/// Accepts three, four, six or eight hexadecimal digits and optionally
- /// a leading hashtag.
+ /// a leading hash.
///
/// If this string is given, the individual components should not be given.
///
@@ -1361,11 +1361,11 @@ impl FromStr for Color {
type Err = &'static str;
/// Constructs a new color from hex strings like the following:
- /// - `#aef` (shorthand, with leading hashtag),
+ /// - `#aef` (shorthand, with leading hash),
/// - `7a03c2` (without alpha),
/// - `abcdefff` (with alpha).
///
- /// The hashtag is optional and both lower and upper case are fine.
+ /// The hash is optional and both lower and upper case are fine.
fn from_str(hex_str: &str) -> Result<Self, Self::Err> {
let hex_str = hex_str.strip_prefix('#').unwrap_or(hex_str);
if hex_str.chars().any(|c| !c.is_ascii_hexdigit()) {