helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.46k stars 2.48k forks source link

Greek letters trip up syntax highlighting in Haskell #6471

Closed sandalbanditten closed 1 year ago

sandalbanditten commented 1 year ago

Summary

Using greek letters as variable names will make the next keyword get colored as the default foreground color. For example, writing

foo bar = bar + baz * δ
  where baz = 0

will make where lose color and other text modifiers.

Reproduction Steps

I tried this: 1. `hx` 2. Writing a function where the last variable (specifically variable - punctuation, types etc. being typed after the variable will not make any difference) is a greek letter. I expected this to happen: The next keyword should have color and text modifiers. Instead, this happened: The next keyword was the default foreground color and had no text modifiers. ### Helix log
~/.cache/helix/helix.log ``` 2023-03-28T21:21:46.500 helix_view::theme [WARN] Theme: invalid style attribute: virtual 2023-03-28T21:21:46.757 helix_lsp::transport [ERROR] err <- "No 'hie.yaml' found. Try to discover the project type!\n" 2023-03-28T21:21:46.759 helix_lsp::transport [ERROR] err <- "Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.8.0.0 x86_64 ghc-9.0.2\n" 2023-03-28T21:21:46.759 helix_lsp::transport [ERROR] err <- "Current directory: /home/USER/Code/Haskell/P7\n" 2023-03-28T21:21:46.759 helix_lsp::transport [ERROR] err <- "Operating system: linux\n" 2023-03-28T21:21:46.759 helix_lsp::transport [ERROR] err <- "Arguments: [\"--lsp\"]\n" 2023-03-28T21:21:46.759 helix_lsp::transport [ERROR] err <- "Cradle directory: /home/USER/Code/Haskell/P7\n" 2023-03-28T21:21:46.759 helix_lsp::transport [ERROR] err <- "Cradle type: Cabal\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "Tool versions found on the $PATH\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "cabal: 3.4.1.0\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "stack: Not found\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "ghc: 9.0.2\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "\n" 2023-03-28T21:21:46.805 helix_lsp::transport [ERROR] err <- "Consulting the cradle to get project GHC version...\n" 2023-03-28T21:21:47.088 helix_lsp::transport [ERROR] err <- "Project GHC version: 9.0.2\n" 2023-03-28T21:21:47.089 helix_lsp::transport [ERROR] err <- "haskell-language-server exe candidates: [\"haskell-language-server-9.0.2\",\"haskell-language-server\"]\n" 2023-03-28T21:21:47.089 helix_lsp::transport [ERROR] err <- "Launching haskell-language-server exe at:/usr/bin/haskell-language-server\n" 2023-03-28T21:21:47.932 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:47.931882Z | Info | No log file specified; using stderr.\n" 2023-03-28T21:21:47.932 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:47.932287Z | Info | haskell-language-server version: 1.8.0.0 (GHC: 9.0.2) (PATH: /usr/bin/haskell-language-server)\n" 2023-03-28T21:21:47.932 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:47.932603Z | Info | Directory: /home/USER/Code/Haskell/P7\n" 2023-03-28T21:21:47.932 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:47.932699Z | Info | Starting (haskell-language-server) LSP server...\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " PluginIds: [ pragmas\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , LSPRecorderCallback\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , rename\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-completions\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , class\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , refineImports\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , splice\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , changeTypeSignature\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , qualifyImportedNames\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , alternateNumberFormat\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , hlint\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-fill-holes\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , floskell\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-extend-import-action\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , codeRange\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , haddockComments\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , importLens\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , retrie\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-type-lenses\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-imports-exports\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-hover-and-symbols\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , eval\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , gadt\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , fourmolu\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , tactics\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , callHierarchy\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , stylish-haskell\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-type-signatures\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-bindings\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , moduleName\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , brittany\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ormolu\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , ghcide-core\n" 2023-03-28T21:21:47.933 helix_lsp::transport [ERROR] err <- " , explicitFixity ]\n" 2023-03-28T21:21:47.934 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:47.933964Z | Info | Logging heap statistics every 60.00s\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " 2023-03-28T19:21:47.942573Z | Info | Starting LSP server...\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " PluginIds: [ pragmas\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , LSPRecorderCallback\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , rename\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-completions\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , class\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , refineImports\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , splice\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , changeTypeSignature\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , qualifyImportedNames\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , alternateNumberFormat\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , hlint\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-fill-holes\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , floskell\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-extend-import-action\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , codeRange\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , haddockComments\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , importLens\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , retrie\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-type-lenses\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-imports-exports\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-hover-and-symbols\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , eval\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , gadt\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , fourmolu\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , tactics\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , callHierarchy\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , stylish-haskell\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-type-signatures\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-code-actions-bindings\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , moduleName\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , brittany\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ormolu\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , ghcide-core\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- " , explicitFixity ]\n" 2023-03-28T21:21:47.943 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:47.943221Z | Info | Starting server\n" 2023-03-28T21:21:47.944 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:47.944601Z | Info | Started LSP server in 0.00s\n" 2023-03-28T21:21:48.245 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:48.245064Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 5539944042638462424 \"file:///home/USER/Code/Haskell/P7\"], clientSettings = hashed Nothing}\n" 2023-03-28T21:21:48.351 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:48.351002Z | Info | Cradle path: src/Main.hs\n" 2023-03-28T21:21:48.351 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:48.351165Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Main.hs.\n" 2023-03-28T21:21:48.351 helix_lsp::transport [ERROR] err <- "Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\n" 2023-03-28T21:21:48.351 helix_lsp::transport [ERROR] err <- "You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.\n" 2023-03-28T21:21:49.006 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:49.006176Z | Info | Interface files cache directory: /home/USER/.cache/ghcide/main-1f2aff1beced7d69a94f1791f39437b7fd22982b\n" 2023-03-28T21:21:49.006 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:49.006435Z | Info | Making new HscEnv. In-place unit ids: [main]\n" 2023-03-28T21:21:56.867 helix_lsp::transport [ERROR] err <- "2023-03-28T19:21:56.867366Z | Info | Typechecking reverse dependencies for NormalizedFilePath \"/home/USER/Code/Haskell/P7/src/Main.hs\": [ ]\n" ```
### Platform Linux ### Terminal Emulator st 0.9 ### Helix Version helix 22.12 (cefc9986)
the-mikedavis commented 1 year ago

This is a problem upstream with tree-sitter-haskell: it can't parse the greek letter as an identifier. This may have already been fixed upstream though (https://github.com/tree-sitter/tree-sitter-haskell/commit/1c89468614883e951db7d4ac05a56ec864f80bc1) so we may just need to update tree-sitter-haskell

sandalbanditten commented 1 year ago

I will update the tree-sitter-haskell version and make a pull request.