atom-haskell / language-haskell Goto Github PK
View Code? Open in Web Editor NEWHaskell language support for Atom
Home Page: https://atom.io/packages/language-haskell
License: MIT License
Haskell language support for Atom
Home Page: https://atom.io/packages/language-haskell
License: MIT License
A string of the form """ will break syntax highlighting. All subsequent content in file will be highlighted as thought it were part of the string or until another escaped quote is encountered.
If the first line is #!/usr/bin/env runhaskell
, this is a Haskell file.
The type announcement after where
will fail to be highlighted. For example, the add'
function which follows after where
won't be highlighted.
add :: Int -> Int -> Int
add = add'
where add' :: Int -> Int -> Int
add' a b = a + b
But if I write code like the following, it can be hightlighted correctly.
add :: Int -> Int -> Int
add = add'
where
add' :: Int -> Int -> Int
add' a b = a + b
Both code are compiled, but the previous one can't be highlighted correctly.
oops, I found that the syntax highlighting of github markdown is not correct either.
PS. Hope my poor English can be understood. :)
">" works and does the same thing, however so it may be better to simply remove the "-" completion.
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (C:\Users\S2400075\AppData\Local\atom\app-0.194.0\resources\app.asar\src\package.js:552:9)
<unknown> (C:\Users\S2400075\AppData\Local\atom\app-0.194.0\resources\app.asar\src\package.js:168:43)
Package.measure (C:\Users\S2400075\AppData\Local\atom\app-0.194.0\resources\app.asar\src\package.js:147:15)
Package.load (C:\Users\S2400075\AppData\Local\atom\app-0.194.0\resources\app.asar\src\package.js:161:12)
This is highlighted:
whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
This is not:
whenJust
:: Applicative m
=> Maybe a -> (a -> m ()) -> m ()
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app/src/package.js:565:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app/src/package.js:187:43)
Could you please publish the haskell module to npm? We are using the same highlighting engine as Atom now, and would love to add your grammar:
While my PR #26 has been disregarded, record declarations are still not being highlighted correctly as of v1.4.3
(current master
):
Going back to my fork, I see this after Atom reload:
Clearly, record syntax support is broken in current master.
It looks like this package does not realize that a quasi-quoter is being used, and so it treats the contents and the subsequent code without properly recognizing the presence of the quasi-quoter. Considering the boundless variability of quasi-quoter behavior, perhaps the best thing to do is just treat anything within a quasiquote as its own thing (with an appropriate styling).
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:586:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:188:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:167:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:181:12)
Inline code with (::) breaks syntax highlighting in literate Haskell. See the following screen capture. Notice that the text after f :: a -> a are wrongly highlighted as code:
and see the same text with (::) removed
language-haskell version 1.7.3.
haskell-ghc-mod version 1.11.2.
ide-haskell disabled.
I have been experiencing an issue that when combining type declarations and long strings (more than 94 characters), the highlighting seems to ignore the closing quotation.
module Main where
test :: String
test = "aaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbb"
main = return ()
When opening the above sample, the main = ...
(and anything further, if added) appears highlighted as though it is part of the string.
This no longer happens when performing any of:
test :: String
type declarationStore package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:552:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:168:43)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:161:12)
The screen shot here looks very good. How did you get that? What color scheme is that? What other packages / settings achieved that look? It's better than what I've otherwise achieved. Thanks
(I'm not entirely sure language-haskell
is to blame for this, but) whenever I press enter the cursor is one space to the left or where it is supposed to be. I.e., if I am
-- some comment
^ cursor here
and then press enter it ends up
-- some comment
^ cursor here
rather than
-- some comment
^ cursor here
This didn't use to happen.
Weirdly, when I press enter on a blank line, it does go to the right location.
(PS. I have my tab-size set to 1, for reasons I explain in my blog post about switching to Atom. I wonder if that's related.)
Function names defined as (reserved word)' are highlighted as reserved words (it seems that github has the same problem)
example:
if' :: Bool -> a -> a -> a
if' True x _ = x
if' False _ y = y
iff x y c d = if' ( x < y ) c d
note that iff is not highlighted but if' is
Hey. Is there a possibility to modify grammar so that -- Blah
and -- | Blah
blocks are qualified with different highlight classes? In order to get a distinction on comments and Haddock doc strings, in order to apply different styling. Also, it would be cool if the |
token itself had a qualifier, so that it can be made visually outstanding as well. Thank you.
The following code makes module export highlighting go wonky for the multi-line constructor list and all following exports:
module Fine.Module
( AnExport (ExportKind1, ExportKind2)
, ABigSumType ( SumBranch1
, SumBranch2
, SumBranch3
, SumBranch4)
, nowShownIncorrectly ) where
GitHub's syntax highlighter doesn't like this, either.
The literate haskell grammar correctly works with bird tracks that start with >
, which are equivalent to \begin{code} ... \end{code}
blocks.
However, the tracks that are for specifications, <
, that correspond to \begin{spec} ... \end{spec}
do not work.
A maintained fork is present at https://github.com/atom-haskell/language-haskell. We plan to point the Atom package listing entry to this maintained fork on June 1st provided no interaction on this thread. Other options:
Thanks!
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (C:\Users\user\AppData\Local\atom\app-0.189.0\resources\app\src\package.js:565:9)
<unknown> (C:\Users\user\AppData\Local\atom\app-0.189.0\resources\app\src\package.js:187:43)
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/home/livid/bin/atom-dir/share/atom/resources/app/src/package.js:539:9)
<unknown> (/home/livid/bin/atom-dir/share/atom/resources/app/src/package.js:188:43)
This is only shown in dev-mode, thought I might as well give a heads-up.
I would love to have syntax highlighting for .hsc
and .chs
files, maybe they could just be added to the haskell grammar? I'm a bit unsure since those file types add some stuff that makes hlint error on trying to parse it, and setting the grammar to Haskell automatically enables hlint if you have the plugin installed. On the other hand the few syntactic additions don't really need new highlighting IMO.
Can grammars in Atom depend on one another? Maybe then creating new grammars wouldn't be a problem. Anyway, just FYI, .hsc
belong to to https://github.com/ghc/hsc2hs, .chs
files belong to https://github.com/haskell/c2hs
. Thanks for reading!
After updating language-haskell
(I think there were a few updates, haven't had used ide-haskell for around a week), when I try to open Haskell files, Atom just hangs and asks Keep Waiting or Close.
I tried getting a log from Atom using atom --log-file but it just doesn't seem to work, no file is written, maybe the editor hangs before any logs pop, although that's not what I think.
I'm getting an error trying to install language-haskell for atom run as sudo with the output
[email protected] postinstall /tmp/apm-install-dir-1151121-5681-g8m2sv/node_modules/language-haskell
coffee src/haskell.coffee
/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:127
throw err;
^
Error: EACCES, permission denied '/tmp/apm-install-dir-1151121-5681-g8m2sv/node_modules/language-haskell/src/haskell.coffee'
at Object.fs.statSync (fs.js:696:18)
at compilePath (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:120:18)
at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
at Object. (/usr/local/lib/node_modules/coffee-script/bin/coffee:7:41)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
npm ERR! Linux 4.2.0-22-generic
npm ERR! argv "/usr/share/atom/resources/app/apm/bin/node" "/usr/share/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/home/thomas/.atom/.apm/.apmrc" "--userconfig" "/home/thomas/.atom/.apmrc" "install" "/tmp/d-1151121-5681-1dke0u6/package.tgz" "--target=0.34.3" "--arch=x64"
npm ERR! node v0.10.40
npm ERR! npm v2.13.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: coffee src/haskell.coffee
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'coffee src/haskell.coffee'.
npm ERR! This is most likely a problem with the language-haskell package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! coffee src/haskell.coffee
npm ERR! You can get their info via:
npm ERR! npm owner ls language-haskell
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/apm-install-dir-1151121-5681-g8m2sv/npm-debug.log
Hello!
I've been using language-haskell
and ide-haskell
for some time now and I've noticed that when I open some source files language-haskell makes atom to use 100% of CPU and hangs forever. I'm sure that this is caused by this package, because I disabled everything else and the problem still occurs (after disabling language-haskell
the file opens as it should). I paste the content of an example file causing the error below:
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Type.List where
import Data.Typeable
import Prelude
import GHC.Exts (Constraint)
import GHC.TypeLits
import Type.Bool
import Type.Container
import qualified Type.Set as Set
-- === Wrappers ===
data Lst (l :: [k])
type family FromLst a where FromLst (Lst l) = l
-- === Basic operations ===
type family Removed (el :: e) (cont :: c) :: l
type family RemovedIdx (idx :: Nat) (cont :: c) :: l
type family ElAt (idx :: Nat) (cont :: c) :: l
type instance Removed (el :: e) ((l ': ls) :: [e]) = If (el == l) ls (l ': Removed el ls)
type instance RemovedIdx idx (l ': ls) = If (idx == 0) ls (l ': RemovedIdx (idx - 1) ls)
type instance ElAt idx (l ': ls) = If (idx == 0) l (ElAt (idx - 1) ls)
type instance In a (l ': ls) = If (a == l) True (In a ls)
type instance In a '[] = False
type family SuccMaybe (m :: Maybe Nat) where SuccMaybe (Just n) = Just (n + 1)
SuccMaybe Nothing = Nothing
type instance Index a (l ': ls) = If (a == l) (Just 0) (SuccMaybe (Index a ls))
type instance Index a '[] = (Nothing :: Maybe Nat)
data Recursive a
type instance Index a (Recursive (l ': ls)) = If (a == l) (Just 0) (SuccMaybe (Index a (Recursive ls)))
type instance Index a (Recursive '[] ) = (Nothing :: Maybe Nat)
--type family Index2 (idx :: i) (cont :: c) :: el
type instance Index2 n (a ': as) = If (n == 0) a (Index2 (n - 1) as)
type instance Empty '[] = 'True
type instance Empty (a ': as) = 'False
type instance Append a '[] = '[a]
type instance Append a (l ': ls) = l ': Append a ls
type instance Concat ('[] :: [k]) (lst :: [k]) = lst
type instance Concat ( (l ': ls) :: [k]) (lst :: [k]) = l ': Concat ls lst
type instance Remove a '[] = '[]
type instance Remove a (l ': ls) = If (a == l) ls (l ': Remove a ls)
type instance Diff l '[] = l
type instance Diff l (e ': es) = Diff (Remove e l) es
type instance Size '[] = 0
type instance Size (a ': as) = 1 + Size as
type family Head lst where
Head '[] = 'Nothing
Head (a ': as) = 'Just a
type family Head' lst where Head' (a ': as) = a
--type instance Unique (lst :: [k]) = Set.ToList (Set.AsSet lst)
-- FIXME[WD]: The following is just an fix for using Unique.
-- Due to lack of time this ugly fix has no background - probably some PolyKinded problem.
type family UniqueFix lst where UniqueFix '[] = '[]
UniqueFix lst = Unique lst
type instance Unique (lst :: [k]) = Set.ToList (Set.AsSet lst)
type instance Reverse (lst :: [k]) = Reverse' lst '[]
type family Reverse' lst lst' where
Reverse' '[] lst = lst
Reverse' (l ': ls) lst = Reverse' ls (l ': lst)
type family Take (n :: Nat) lst where
Take 0 lst = '[]
Take n (l ': ls) = l ': Take (n - 1) ls
type family Drop (n :: Nat) lst where
Drop 0 lst = lst
Drop n (l ': ls) = Drop (n - 1) ls
--type instance Index (a :: *) (Recursive ((l ': ls) :: [*] )) = If (a == l) (Just 0) (SuccMaybe (Index a (Recursive ls)))
--type instance Index (a :: *) (Recursive ((l ': ls) :: [[*]])) = If (Index a l == 'Nothing) (SuccMaybe (Index a (Recursive ls))) ('Just 0)
--type instance Index a '[] = 'Nothing
--type instance RecIndex a ((l ': ls) :: [[*]]) = If (RecIndex a l == 'Nothing) (SuccMaybe (RecIndex a ls)) (Just 0)
type family Last (lst :: [k]) :: k where
Last '[x] = x
Last (x ': xs) = Last xs
type family Init (lst :: [k]) :: [k] where
Init '[] = '[]
Init '[x] = '[]
Init (x ': xs) = x ': Init xs
type family DropInit (lst :: [k]) :: [k] where
DropInit '[] = '[]
DropInit '[x] = '[x]
DropInit (x ': xs) = DropInit xs
type family Replicate (n :: Nat) a where
Replicate 0 a = '[]
Replicate n a = a ': Replicate (n - 1) a
type Zip a b = Zip2 a b
type family Zip2 (l1 :: [*]) (l2 :: [*]) :: [*] where
Zip2 (x1 ': xs1) (x2 ': xs2) = (x1,x2) ': Zip2 xs1 xs2
Zip2 l1 l2 = '[]
type family Zip3 (l1 :: [*]) (l2 :: [*]) (l3 :: [*]) :: [*] where
Zip3 (x1 ': xs1) (x2 ': xs2) (x3 ': xs3) = (x1,x2,x3) ': Zip3 xs1 xs2 xs3
Zip3 l1 l2 l3 = '[]
type family Zip4 (l1 :: [*]) (l2 :: [*]) (l3 :: [*]) (l4 :: [*]) :: [*] where
Zip4 (x1 ': xs1) (x2 ': xs2) (x3 ': xs3) (x4 ': xs4) = (x1,x2,x3,x4) ': Zip4 xs1 xs2 xs3 xs4
Zip4 l1 l2 l3 l4 = '[]
type family Zip5 (l1 :: [*]) (l2 :: [*]) (l3 :: [*]) (l4 :: [*]) (l5 :: [*]) :: [*] where
Zip5 (x1 ': xs1) (x2 ': xs2) (x3 ': xs3) (x4 ': xs4) (x5 ': xs5) = (x1,x2,x3,x4,x5) ': Zip5 xs1 xs2 xs3 xs4 xs5
Zip5 l1 l2 l3 l4 l5 = '[]
type family Unzip2 (lst :: [*]) :: ([*], [*]) where
Unzip2 '[] = '( '[], '[] )
Unzip2 ((x1,x2) ': lst) = PrependAll (x1,x2) (Unzip2 lst)
--type family Unzip3 (lst :: [*]) :: ([*], [*], [*]) where
-- Unzip3 '[] = '( '[], '[] )
-- Unzip3 ((x1,x2) ': lst) = PrependAll (x1,x2) (Unzip3 lst)
type family PrependAll (els :: *) (lsts :: k) :: k
type instance PrependAll (t1,t2) '(l1,l2) = '(t1 ': l1, t2 ': l2)
type instance PrependAll (t1,t2,t3) '(l1,l2,l3) = '(t1 ': l1, t2 ': l2, t3 ': l3)
type instance PrependAll (t1,t2,t3,t4) '(l1,l2,l3,l4) = '(t1 ': l1, t2 ': l2, t3 ': l3, t4 ': l4)
type instance PrependAll (t1,t2,t3,t4,t5) '(l1,l2,l3,l4,l5) = '(t1 ': l1, t2 ': l2, t3 ': l3, t4 ': l4, t5 ': l5)
type family Select (n :: Nat) (a :: *) :: *
type instance Select 1 (t1,t2) = t1
type instance Select 2 (t1,t2) = t2
type instance Select 1 (t1,t2,t3) = t1
type instance Select 2 (t1,t2,t3) = t2
type instance Select 3 (t1,t2,t3) = t3
type instance Select 1 (t1,t2,t3,t4) = t1
type instance Select 2 (t1,t2,t3,t4) = t2
type instance Select 3 (t1,t2,t3,t4) = t3
type instance Select 4 (t1,t2,t3,t4) = t4
type instance Select 1 (t1,t2,t3,t4,t5) = t1
type instance Select 2 (t1,t2,t3,t4,t5) = t2
type instance Select 3 (t1,t2,t3,t4,t5) = t3
type instance Select 4 (t1,t2,t3,t4,t5) = t4
type instance Select 5 (t1,t2,t3,t4,t5) = t5
type family Update (n :: Nat) (a :: k) (lst :: [k]) :: [k] where
Update 0 a (l ': ls) = a ': ls
Update n a (l ': ls) = l ': Update (n - 1) a ls
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Users/tsungyensu/Desktop/Atom.app/Contents/Resources/app/src/package.js:550:9)
<unknown> (/Users/tsungyensu/Desktop/Atom.app/Contents/Resources/app/src/package.js:172:43)
Is there any way to get the comments keybinding to prepend --
to a line, or is that beyond the scope of this project?
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/usr/share/atom/resources/app/src/package.js:547:9)
<unknown> (/usr/share/atom/resources/app/src/package.js:168:43)
I have a tendency to write multi-line type signatures, e.g.:
square :: Num a
=> a
-> a
and it looks like language-haskell
only matches the type constraint Num a
as a constraint if it’s on the same line as the =>
. I looked at fixing this but unfortunately I don’t have a very good understanding of the Atom grammar, and it seems like multi-line matching might get tricky.
Any thoughts?
When a module name has as
in it (after the last .
), that part of the module name is highlighted.
Example:
import SomeModule.Base
This applies to both single-line and multiline comments.
When using literate Haskell, it is common for authors to use lhs2TeX. Text is treated as comments by default. In this context, inline references to code are usually made between |
symbols, for instance, we might discuss the type of id
and write |id :: a -> a|
. Currently the syntax highlighting for such quoted code does not work as expected (it's not unhighlighted, but it's not treated as Haskell code either).
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (C:\Users\xxx\AppData\Local\atom\app-0.198.0\resources\app.asar\src\package.js:586:9)
<unknown> (C:\Users\xxx\AppData\Local\atom\app-0.198.0\resources\app.asar\src\package.js:188:43)
Package.measure (C:\Users\xxx\AppData\Local\atom\app-0.198.0\resources\app.asar\src\package.js:167:15)
Package.load (C:\Users\xxx\AppData\Local\atom\app-0.198.0\resources\app.asar\src\package.js:181:12)
As far as I can tell (though things seems to vary depending on color scheme chosen), there's no highlighting distinction for parentheses and brackets etc.
There seems to be a problem with FFI and/or conditional compilation.
Consider this GHCJS example from http://weblog.luite.com/wordpress/?p=14
foo = "with an escaped \", multiline\
\strings do not parse."
The escaped quote breaks the embedded newline parse, and everything after the escaped quote is treated as outside the string.
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (C:\Users\Erwin\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:566:9)
<unknown> (C:\Users\Erwin\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:168:43)
Package.measure (C:\Users\Erwin\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:147:15)
Package.load (C:\Users\Erwin\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:161:12)
When I type mo
or im
I see module or import snippet.
But when I type {
or >
, nothing happens.
They present in snippet list (Snippets: Available), but are not triggered automatically.
And even when I use the Pragma snippet from the list, it inserts only {-# #-
, so I assume it definitely is not the proper way to insert this snippet.
So how to use it properly? Or is it broken?
Any chance you could do an official release of the latest version? The version one gets from within atom
doesn't have the module
fix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.