Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPM Spec file language support #11563

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
| rmarkdown | ✓ | | ✓ | `R` |
| robot | ✓ | | | `robotframework_ls` |
| ron | ✓ | | ✓ | |
| rpmspec | ✓ | | | `rpm_lsp_server` |
| rst | ✓ | | | |
| ruby | ✓ | ✓ | ✓ | `solargraph` |
| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
Expand Down
16 changes: 15 additions & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ inlayHints.discriminantHints.enable = "fieldless"
inlayHints.lifetimeElisionHints.enable = "skip_trivial"
inlayHints.typeHints.hideClosureInitialization = false

[language-server.rpm-spec-language-server]
command = "rpm_lsp_server"
args = ["--stdio"]

[language-server.typescript-language-server]
command = "typescript-language-server"
Expand Down Expand Up @@ -3785,4 +3788,15 @@ indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "thrift"
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-thrift" , rev = "68fd0d80943a828d9e6f49c58a74be1e9ca142cf" }
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-thrift" , rev = "68fd0d80943a828d9e6f49c58a74be1e9ca142cf" }

[[language]]
name = "rpmspec"
scope = "source.rpmspec"
comment-token = "#"
file-types = ["spec"]
language-servers = ["rpm-spec-language-server"]

[[grammar]]
name = "rpmspec"
source = { git = "https://gitlab.com/cryptomilk/tree-sitter-rpmspec", rev = "22298ebd815ce77b97d893b79c95c784448c4e05" }
74 changes: 74 additions & 0 deletions runtime/queries/rpmspec/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
(variable_name) @variable

(macro_definition) @keyword.directive.define
(macro_invocation) @keyword.function
(macro_expansion) @keyword

[
(tag)
(dependency_tag)
] @type.definition

[
(integer)
(float)
] @number
Comment on lines +12 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[
(integer)
(float)
] @number
(integer) @constant.numeric.integer
(float) @constant.numeric.float


(comment) @comment
(string) @string

(if_statement) @keyword

[
"%description"
"%package"
(files)
(changelog)
] @type.definition

[
(prep_scriptlet)
(generate_buildrequires)
(conf_scriptlet)
(build_scriptlet)
(install_scriptlet)
(check_scriptlet)
(clean_scriptlet)
] @function.builtin

[
"%artifact"
"%attr"
"%config"
"%dir"
"%doc"
"%docdir"
"%ghost"
"%license"
"%missingok"
"%readme"
] @keyword.type

;[
; "!="
; "<"
; "<="
; "=="
; ">"
; ">="
; "&&"
; "||"
;] @operator

[
"%if"
"%ifarch"
"%ifos"
"%ifnarch"
"%ifnos"
"%elif"
"%elifarch"
"%elifos"
"%else"
"%endif"
] @keyword.conditional