as should be a rustKeyword not rustOperator for syntax highlighting

未关闭 适合新手
#493 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
vim
领域
tooling

调研方向

从 runtime/syntax/rust.vim 开始,issue 指出其中将 as 分类为 rustOperator。将它的高亮与示例中的其他 Rust 关键字进行比较,并确定语法组定义的位置。完成标准是:在引用的表达式中,as 的高亮方式与 use 和 let 相同,而不是与 = 或 + 相同。

由索引模型根据 Issue 内容生成。

描述

The as keyword is currently a rustOperator according to runtime/syntax/rust.vim, which is kind of surprising because in these kinds of expressions:

use foo as bar;
let thing1: u8 = 7 + 8 as u8;
use std::{mem as memory, net as network};

I expect as to always have the same highlighting as use and let, but not as = or +.

In fact in all rust documentation, it is highlighted as if it were a keyword, not an operator, and in every syntax highlighter online (e.g. right here, and in stackoverflow) it is also highlighted as if it were a keyword and not an operator.

As it stands, gruvbox (a universally loved colorscheme, the most popular Vim and neovim colorscheme) actually makes it look like the syntax file doesn't even support the language feature as.

Screenshot 2023-02-13 at 14 03 49

I think that's very ugly, and confusing. The disparity between everything you read in documentation and your local editor makes you question "is my runtime broken? up-to-date?"

主要语言
Vim Script
星标
4.2k
派生
323
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rust-lang/rust.vim 的其他 Issue

查看 rust-lang/rust.vim 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。