Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: sync language support (#2123)
Matthew Espino48f1d868ff39
diff --git a/harper-comments/src/comment_parser.rs b/harper-comments/src/comment_parser.rsindex 5b6e3b1d3..a414c2f6a 100644--- a/harper-comments/src/comment_parser.rs+++ b/harper-comments/src/comment_parser.rs@@ -23,16 +23,17 @@ impl CommentParser {markdown_options: MarkdownOptions,) -> Option<Self> {let language = match language_id {+ "c" => tree_sitter_c::LANGUAGE,+ "clojure" => tree_sitter_clojure::LANGUAGE,"cmake" => tree_sitter_cmake::LANGUAGE,"cpp" => tree_sitter_cpp::LANGUAGE,"csharp" => tree_sitter_c_sharp::LANGUAGE,- "c" => tree_sitter_c::LANGUAGE,"dart" => harper_tree_sitter_dart::LANGUAGE,"go" => tree_sitter_go::LANGUAGE,"haskell" => tree_sitter_haskell::LANGUAGE,- "javascriptreact" => tree_sitter_typescript::LANGUAGE_TSX,- "javascript" => tree_sitter_javascript::LANGUAGE,"java" => tree_sitter_java::LANGUAGE,+ "javascript" => tree_sitter_javascript::LANGUAGE,+ "javascriptreact" => tree_sitter_typescript::LANGUAGE_TSX,"kotlin" => tree_sitter_kotlin_ng::LANGUAGE,"lua" => tree_sitter_lua::LANGUAGE,"nix" => tree_sitter_nix::LANGUAGE,@@ -44,19 +45,18 @@ impl CommentParser {"solidity" => tree_sitter_solidity::LANGUAGE,"swift" => tree_sitter_swift::LANGUAGE,"toml" => tree_sitter_toml_ng::LANGUAGE,- "typescriptreact" => tree_sitter_typescript::LANGUAGE_TSX,"typescript" => tree_sitter_typescript::LANGUAGE_TYPESCRIPT,- "clojure" => tree_sitter_clojure::LANGUAGE,+ "typescriptreact" => tree_sitter_typescript::LANGUAGE_TSX,_ => return None,};let comment_parser: Box<dyn Parser> = match language_id {"go" => Box::new(Go::new_markdown(markdown_options)),- "lua" => Box::new(Lua::new_markdown(markdown_options)),"java" => Box::new(JavaDoc::default()),- "javascriptreact" | "typescript" | "typescriptreact" | "javascript" => {+ "javascript" | "javascriptreact" | "typescript" | "typescriptreact" => {Box::new(JsDoc::new_markdown(markdown_options))}+ "lua" => Box::new(Lua::new_markdown(markdown_options)),"solidity" => Box::new(Solidity::new_markdown(markdown_options)),_ => Box::new(Unit::new_markdown(markdown_options)),};@@ -81,14 +81,13 @@ impl CommentParser {/// [`Self::new_from_language_id`]fn filename_to_filetype(path: &Path) -> Option<&'static str> {Some(match path.extension()?.to_str()? {- "bash" => "shellscript","c" => "c",+ "bb" | "cljc" | "cljd" | "clj" | "cljs" => "clojure","cmake" => "cmake",- "cpp" => "cpp",+ "cpp" | "h" => "cpp","cs" => "csharp","dart" => "dart","go" => "go",- "h" => "cpp","hs" => "haskell","java" => "java","js" => "javascript",@@ -97,17 +96,15 @@ impl CommentParser {"lua" => "lua","nix" => "nix","php" => "php",- "py" => "python","rb" => "ruby","rs" => "rust",- "scala" | "sbt" | "mill" => "scala",- "sh" => "shellscript",+ "sbt" | "sc" | "scala" | "mill" => "scala",+ "bash" | "sh" => "shellscript","sol" => "solidity","swift" => "swift","toml" => "toml","ts" => "typescript","tsx" => "typescriptreact",- "clj" | "cljc" | "cljd" | "cljs" | "bb" => "clojure",_ => return None,})}diff --git a/harper-ls/src/backend.rs b/harper-ls/src/backend.rsindex 4032e9bcf..d3838181f 100644--- a/harper-ls/src/backend.rs+++ b/harper-ls/src/backend.rs@@ -359,7 +359,15 @@ impl Backend {Some(Box::new(ts_parser))}}- "literate haskell" | "lhaskell" => {+ "git-commit" | "gitcommit" => {+ Some(Box::new(GitCommitParser::new_markdown(markdown_options)))+ }+ "html" => Some(Box::new(HtmlParser::default())),+ "ink" => Some(Box::new(InkParser::default())),+ "jj-commit" | "jjdescription" => {+ Some(Box::new(JJDescriptionParser::new(markdown_options)))+ }+ "lhaskell" | "literate haskell" => {let parser = LiterateHaskellParser::new_markdown(markdown_options);if let Some(new_dict) =@@ -381,17 +389,12 @@ impl Backend {Some(Box::new(parser))}}- "ink" => Some(Box::new(InkParser::default())),+ "mail" => Some(Box::new(PlainEnglish)),"markdown" => Some(Box::new(Markdown::new(markdown_options))),- "git-commit" | "gitcommit" => {- Some(Box::new(GitCommitParser::new_markdown(markdown_options)))- }- "jjdescription" => Some(Box::new(JJDescriptionParser::new(markdown_options))),- "html" => Some(Box::new(HtmlParser::default())),- "mail" | "plaintext" | "text" => Some(Box::new(PlainEnglish)),- "typst" => Some(Box::new(Typst)),"org" => Some(Box::new(OrgMode)),+ "plaintext" | "text" => Some(Box::new(PlainEnglish)),"python" => Some(Box::new(PythonParser::default())),+ "typst" => Some(Box::new(Typst)),_ => None,};diff --git a/packages/vscode-plugin/package.json b/packages/vscode-plugin/package.jsonindex 3b0e6f1c2..51d68b48a 100644--- a/packages/vscode-plugin/package.json+++ b/packages/vscode-plugin/package.json@@ -32,35 +32,39 @@],"activationEvents": ["onLanguage:c",+ "onLanguage:clojure","onLanguage:cmake","onLanguage:cpp","onLanguage:csharp",+ "onLanguage:dart","onLanguage:git-commit","onLanguage:go","onLanguage:haskell","onLanguage:html",+ "onLanguage:ink","onLanguage:java","onLanguage:javascript","onLanguage:javascriptreact",+ "onLanguage:jj-commit","onLanguage:kotlin","onLanguage:literate haskell","onLanguage:lua","onLanguage:markdown",- "onLanguage:dart","onLanguage:nix",+ "onLanguage:org","onLanguage:php","onLanguage:plaintext","onLanguage:python","onLanguage:ruby","onLanguage:rust",+ "onLanguage:scala","onLanguage:shellscript","onLanguage:solidity","onLanguage:swift","onLanguage:toml","onLanguage:typescript","onLanguage:typescriptreact",- "onLanguage:typst",- "onLanguage:clojure"+ "onLanguage:typst"],"main": "./build/extension.js","contributes": {diff --git a/packages/web/src/routes/docs/integrations/language-server/+page.md b/packages/web/src/routes/docs/integrations/language-server/+page.mdindex 0669bbe67..4dfc48865 100644--- a/packages/web/src/routes/docs/integrations/language-server/+page.md+++ b/packages/web/src/routes/docs/integrations/language-server/+page.md@@ -267,41 +267,43 @@ These configs are under the `markdown` key:`harper-ls` supports a wide variety of programming and markup languages.-| Language | Language ID | Comments Only |-| :---------------- | :---------------------------: | ------------: |-| C | `c` | ✅ |-| CMake | `cmake` | ✅ |-| C++ | `cpp` | ✅ |-| C# | `csharp` | ✅ |-| Dart | `dart` | ✅ |-| Email | `mail` | |-| Git Commit | `git-commit`/`gitcommit` | |-| Go | `go` | ✅ |-| Haskell | `haskell` | ✅ |-| HTML | `html` | |-| Java | `java` | ✅ |-| JavaScript | `javascript` | ✅ |-| JavaScript React | `javascriptreact` | ✅ |-| Literate Haskell | `literate haskell`/`lhaskell` | |-| Lua | `lua` | ✅ |-| Markdown | `markdown` | |-| Nix | `nix` | ✅ |-| PHP | `php` | ✅ |-| Plain Text | `plaintext`/`text` | |-| Python | `python` | ✅ |-| Ruby | `ruby` | ✅ |-| Rust | `rust` | ✅ |-| Scala | `scala` | ✅ |-| Shell/Bash Script | `shellscript` | ✅ |-| Solidity | `solidity` | ✅ |-| Swift | `swift` | ✅ |-| TOML | `toml` | ✅ |-| TypeScript | `typescript` | ✅ |-| TypeScript React | `typescriptreact` | ✅ |-| Typst | `typst` | |-| Kotlin | `kotlin` | ✅ |-| Clojure | `clojure` | ✅ |-| Ink | `ink` | |+| Language | Language ID | Comments Only |+| :------------------ | :---------------------------: | ------------: |+| C | `c` | ✅ |+| Clojure | `clojure` | ✅ |+| CMake | `cmake` | ✅ |+| C++ | `cpp` | ✅ |+| C# | `csharp` | ✅ |+| Dart | `dart` | ✅ |+| Git Commit | `git-commit`/`gitcommit` | |+| Go | `go` | ✅ |+| Haskell | `haskell` | ✅ |+| HTML | `html` | |+| Ink | `ink` | |+| Java | `java` | ✅ |+| JavaScript | `javascript` | ✅ |+| JavaScript React | `javascriptreact` | ✅ |+| Jujutsu Description | `jj-commit`/`jjdescription` | |+| Kotlin | `kotlin` | ✅ |+| Literate Haskell | `lhaskell`/`literate haskell` | |+| Lua | `lua` | ✅ |+| Email | `mail` | |+| Markdown | `markdown` | |+| Nix | `nix` | ✅ |+| Org Mode | `org` | |+| PHP | `php` | ✅ |+| Plain Text | `plaintext`/`text` | |+| Python | `python` | ✅ |+| Ruby | `ruby` | ✅ |+| Rust | `rust` | ✅ |+| Scala | `scala` | ✅ |+| Shell/Bash Script | `shellscript` | ✅ |+| Solidity | `solidity` | ✅ |+| Swift | `swift` | ✅ |+| TOML | `toml` | ✅ |+| TypeScript | `typescript` | ✅ |+| TypeScript React | `typescriptreact` | ✅ |+| Typst | `typst` | |Want your language added?Let us know by [commenting on this issue](https://github.com/Automattic/harper/issues/79).