Giter Club home page Giter Club logo

sublimehaskell's Introduction

README

Package Control Join the chat at https://gitter.im/SublimeHaskell/SublimeHaskell PayPal Flattr this git repo

look

Quick link ==> SublimeHaskell's Documentation

Setup

Required (Before You Install SublimeHaskell)

You will need to install either the GHC Haskell compiler and cabal either stack build tool and a backend before you install SublimeHaskell.

  • stack will install ghc automatically, so there's no need to install GHC independently:
  • or you may install Haskell Platform (includes cabal build tool):
    • The Glorious Haskell Computer (ghc). Preferably, you should install the Haskell Platform if you don't already have a Haskell development and hacking environment set up.
    • cabal. Under normal circumstances, cabal should come pre-installed with your Haskell environment, e.g., if you installed the Haskell Platform.
  • A backend. SublimeHaskell communicates with the backend to support the interesting editing features. The preferred backend is hsdev. You can use one of the deprecated backends, but know that support for these backends may be dropped or removed in a future SublimeHaskell release.
    • hsdev cabal package for inspection, enhanced completion, goto, symbol info etc.
      Installation:
      • with cabalcabal install hsdev
      • with stack — create config (for example, hsdev.yaml) with contents:
        packages: []
        resolver: lts-13.29
        extra-deps:
        - hsdev-0.3.3.1
        - haddock-api-2.21.0
        - hdocs-0.5.3.1
        - network-3.0.1.1
        
        And then run stack install hsdev --stack-yaml hsdev.yaml
    • Deprecated backends
      • ghc-mod (for import and LANGUAGE completions and type inference, cabal install ghc-mod, not used if hsdev enabled, ghc-mod is used by hsdev as a library)

Install SublimeHaskell

  1. Get Sublime Text: http://www.sublimetext.com/
  2. Install the Sublime Package Control package: http://wbond.net/sublime_packages/package_control/installation
  3. Use Package Control to install SublimeHaskell

Open a Haskell source file, cabal builder file or a stack.yaml builder and have a productive Haskell development session!

Optional Tools

  • stack. The Haskell Tool Stack. If you installed the Haskell Platform, you already have this installed. stack is a companion Haskell build tool that supplements cabal.
  • SublimeREPL package for REPL support, if you want to interact with GHCI from within SublimeText.
  • Code prettifier:

Tool Installation Location

Tools (cabal, hsdev, ghc-mod, ghc, etc.) are usually installed in a directory that is already added to your PATH environment variable. SublimeHaskell will also look for these tools in several "Haskell standard" places. These places include:

Builder *nix Platforms Windows
stack $HOME/.local/bin %APPDATA%/local/bin
cabal user $HOME/.cabal/bin %APPDATA/cabal/bin
cabal global /usr/local/bin %PROGRAMFILES%/Haskell/bin

More advanced users can configure cabal's user and global install paths in $HOME/.cabal/config. SublimeHaskell will use these values if configured and if the directories to which they refer exist.

If you have a non-standard installation location for your tools, you can configure this in SublimeHaskell's "User Settings" by adjusting add_to_PATH. You will have to restart SublimeText after you save your preferences.

SublimeHaskell Theme

There is a special theme with enhanced Haskell entities and marks (errors, warnings and hints) coloring. Note different coloring for types and constructors (in import list, data declaration etc.), special coloring of generic variables in types, pragmas and module imports

compare

Quickstart

  • Open the SublimeText Command Palette ( Ctrl-Shift-P or Option-Command-P on OS X) and type haskell to explore SublimeHaskell's goodness.

  • When editing Haskell source files, automatic error highlighting and enhanced auto-completion is available.

  • Each time you save, any errors in your program will be listed at the bottom of the window and highlighted in the source code.

  • All source files in the project are scanned on change. Any symbols that they export are provided in the auto-complete suggestions.

  • Stylish-haskell can be used to stylish file or selected text.

  • Use F12 to go to declaration and ctrl+k ctrl+i to show symbol info with documentation. These commands are also available through context menu with right-click.

  • To show inferred types use Show type (ctrl-k ctrl-h ctrl-t) command.

  • To insert inferred type use Insert type (ctrl-k ctrl-h ctrl-i).

  • You can jump between the errors and warnings with alt+d alt+e and alt+shift+d alt+shift+e.

  • To show hidden error output, use command Show error panel (ctrl-alt-e)

Features and SublimeHaskell Goodness

Stack support

Build commands such as Build, Clean, Install, Rebuild uses stack if there is stack.yaml near .cabal. If you don't want to use stack, set haskell_build_tool setting to cabal.

hsdev uses stack to build dependencies and to get corresponding package-dbs. Since 0.1.7.2 it passes --compiler and --arch options to stack to get package-dbs built with hsdev-compatible compiler.

Enhanced completion

Works in export list (showing symbols in scope), import list, expressions. Completes after module qualifier (several modules can be import qualified as with same qualifier). Takes into account module reexports for sources. Autocompletion

Popups

  • Show popup with symbol info and with error/warning/hint details. Requires SublimeText 3 dev build > 3116 (https://forum.sublimetext.com/t/dev-build-3116/21148). Hover

  • It also shows inferred type when possible HoverTypes

  • You can select all usages of symbol via link HoverUsages

  • And you can autofix warnings/hints on popup for warnings/hints AutoFixHover

Commands:

  • SublimeHaskell: Insert import for symbol — add import for declaration InsertImport
  • SublimeHaskell: Find declarations — find declarations in installed packages and in projects
  • SublimeHaskell: Search declarations everywhere — search declarations in hayoo too
  • SublimeHaskell: Browse module — get declarations for module BrowseModule
  • SublimeHaskell: Browse declarations — get declarations in scope of current file
  • SublimeHaskell: Show symbol info — get help for symbol, ctrl+k ctrl+i
  • SublimeHaskell: Toggle symbol info panel — toggle continuout symbol info panel, which show info about symbol under cursor. Useful when reading code. SymbolInfo
  • SublimeHaskell: Go to module — go to module, ctrl+k ctrl+p GoToModule
  • SublimeHaskell: Go to declaration — overrides default, f12
  • Ctrl+R, Ctrl+Shift+R — overrides default, goto symbol and goto symbol in project
  • SublimeHaskell: Show type — show type/types for current expression, ctrl-k ctrl-h ctrl-t
  • SublimeHaskell: Expand selection to Expression — expand selection to expression, ctrl+shift+y
  • SublimeHaskell: Show/hide all types — get all types and highlight while selection modifies, ctrl+t, h Types
  • SublimeHaskell: Insert type — insert type for selected expression, ctrl-k ctrl-h ctrl-i
  • SublimeHaskell: Hayoo — search in hayoo
  • SublimeHaskell: Auto fix — auto fix some of warnings and/or errors (for now redundant imports and hlint hints) AutoFix
  • SublimeHaskell: Stylish — stylish source with stylish-haskell
  • SublimeHaskell: Scan docs and infer types — as long as scanning docs for sources and inferring types is long process, it's disabled by default, but this command can be used to scan docs and infer types for currently opened view
  • SublimeHaskell: Check & Lint — check/lint/check & lint opened file. Enable option check_lint_fly to check & lint on idle, rescanning actual source, so that completions are updated
  • SublimeHaskell: Eval expression — evaluate expression in context of current module
  • SublimeHaskell: Expression type — evaluate expression type in context of current module
  • Eval commands — see animation
    • SublimeHaskell: Eval selection — eval selected expression, for example
      • [1..10][1,2,3,4,5,6,7,8,9,10]
      • replicate 10 'a'aaaaaaaaaa (note no double quotes for string result)
    • SublimeHaskell: Apply to selection — same as above, but applies function to each selection
      • foobarreverseraboof
      • [1..10]reverse[10,9,8,7,6,5,4,3,2,1]
      • 1, 2, 3succ2, 3, 4
      • [1..3]intercalate ", " . map (\i -> "foo" ++ show i)foo1, foo2, foo3
    • SublimeHaskell: Apply to selection list — applies function to list made from selections
      • foo, bar, bazreversebaz, bar, foo
      • foo, bar, bazsortbar, baz, foo
  • Repl commands (uses SublimeREPL package)
    • SublimeHaskell Repl: GHCi — runs ghci
    • SublimeHaskell Repl: GHCi current file — runs ghci and loads current file
    • SublimeHaskell Repl: Cabal Repl — runs cabal repl for current project
    • SublimeHaskell Repl: Load — loads current file or project in repl
  • Context menu commands
    • Open package on Hackage — works within symbol info panel, opens Hackage page
    • Open module on Hackage — words in symbol info panel and in sources, opens Hackage page for selected module
    • Show symbol usages — show list of locations where symbol is used
  • Build commands
    • Build, Typecheck build (no codegen), Clean, Configure, Rebuild, Install, Test, Run
  • Error commands:
    • SublimeHaskell: Go to next error — go to next error in file, alt+d alt+e
    • SublimeHaskell: Go to previous error — go to previous error in file, alt+shift+d alt+shift+e
    • SublimeHaskell: Show error panel — show error panel if it was hidden, ctrl+alt+e

Inside and outside your project: codex

codex allows you to use ctags to jump to definitions that are declared in your cabal dependencies.

  • cabal install codex
  • Run codex set format sublime, that updates your ~/.codex file to Sublime's Ctags plugin's format
  • Change ~/.codex to tagsFileName: .tags
  • In your project, codex cache clean && codex update
  • You can now jump to the source code of definitions outside of your project.
  • The commands CTags: Show Symbols and CTags: Rebuild Tags currently don't work with codex

Credits

Icons from FlatIcon.

Error icon by Eleonor Wang
Warning icon by Freepik
Hint icon by Gregor Cresnar
Wrench icon by Gregor Cresnar

sublimehaskell's People

Contributors

aktowns avatar albertfong avatar aninhumer avatar anton-dessiatov avatar armed avatar axman6 avatar bheklilr avatar brandon-leapyear avatar brandonchinn178 avatar bscottm avatar dniku avatar dten avatar dylanmann avatar ghostbarik avatar henriks avatar holmak avatar joneshf avatar jtojnar avatar kgadek avatar kolmodin avatar masseguillaume avatar mrkafk avatar mvoidex avatar nh2 avatar nikita-volkov avatar princemaple avatar sukhodolin avatar wrossmck avatar xdrop avatar xldenis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublimehaskell's Issues

loading standard modules

Sublime Haskell: loading standard modules info for cabal within 111.931780307 seconds

Is this supposed to happen every time Sublime starts?

I think there was once that Sublime Haskell can cache this,
not loading for 100+ seconds every time.
Now it doesn't? Or I remembered wrong?

data-aeson dependency not found

The README says I have to install data-aeson, but running mariosangiorgio:~/ $ cabal install data-aeson results into:

cabal: There is no package named 'data-aeson'.
You may need to run 'cabal update' to get the latest list of available
packages.

Is that the required package? I see that I can install aeson and I guess it has just be renamed

SublimeHaskell: Check doesn't produce any output

When I run SublimeHaskell: Check on a haskell file (either inside or outside a cabal project), it sets the status message to 'Ghc-mod: Checking $file.hs', but then fails to produce any output (either any additional status messages, or messages in the console, or a new window with the build results). Running ghc-mod manually from a terminal works and returns output.

I'm running ghc 7.4.2, with ghc-mod in ~/.cabal/bin (which I've already added as an absolute path to the add_to_PATH setting for SublimeHaskell.

The only possible issue that I see is that when I run sublime_text from the command line, I see the following message: 'Unhandled exception in thread started by ', both on startup, and also when I run ghc-mod. However, I don't know where to go from there.

I'm a fairly experienced python developer, relatively novice haskell developer, and have never done anything with SublimeText plugins before, but please let me know if there's any more information that would be helpful in diagnosing this.

reinspecting <project> (1/1) ... crash

I've got a fresh install of sublime-text-2 with SublimeHaskell (no other packages).

When opening a cabal project it keeps saying this, seemingly forever:
here

When I try out commands like "Show type" it crashes sublime-text.

I've got all needed cabal packages installed.

any ideas?

Broken `(` behaviour

The recent updates introduce a default key setting for left brace, which makes it impossible to enclose a selected text in braces.

Reproduction:

  1. type abc
  2. select it
  3. hit (

This would result in abc(, while previously it resulted in way more meaningful (abc).

Exception running CabalInspector

Log shows an exception:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "./autocomplete.py", line 902, in run
  File "./autocomplete.py", line 944, in _refresh_all_module_info
  File "./autocomplete.py", line 995, in _refresh_module_info
  File "./sublime_haskell_common.py", line 336, in get_source_dir
  File "./sublime_haskell_common.py", line 94, in call_and_wait
  File "./sublime_haskell_common.py", line 137, in call_and_wait_with_input
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
TypeError: coercing to Unicode: need string or buffer, tuple found

The locals() in call_with_wait_and_input before the call to subprocess:

{'PATH': u'/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/scott/bin',
 'command': [u'/Users/ssadler/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/CabalInspector',
             (u'eq', u'/Users/scott/Code/eq/eq.cabal')],
 'extended_env': {...},
 'input_string': None,
 'popen_kwargs': {}}

Looks like the offending tuple is: (u'eq', u'/Users/scott/Code/eq/eq.cabal')

Not sure how to fix this, it does run several times successfully before failing.

A couple of other exceptions in the log below, you can see the commands being run prefixed with >>>:

startup, version: 2217 osx x64 channel: stable
executable: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
working dir: /
packages path: /Users/scott/Library/Application Support/Sublime Text 2/Packages
settings path: /Users/scott/Library/Application Support/Sublime Text 2/Settings
PackageSetup not required
catalogue loaded
found 8 files for base name Default.sublime-keymap
found 2 files for base name Default.sublime-mousemap
found 5 files for base name Main.sublime-menu
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/CSS/css_completions.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/ColorPicker/sublimecp.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/comment.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/copy_path.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/delete_word.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/detect_indentation.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/duplicate_line.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/echo.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/exec.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/fold.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/font.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/goto_line.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/indentation.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/kill_ring.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/mark.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/new_templates.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/open_file_settings.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/open_in_browser.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/paragraph.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/save_on_focus_lost.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/scroll.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/set_unsaved_view_name.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/side_bar.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/sort.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/swap_line.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/switch_file.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/transform.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/transpose.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Default/trim_trailing_white_space.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Diff/diff.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/HTML/encode_html_entities.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/HTML/html_completions.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/Package Control/Package Control.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeCodeIntel/SublimeCodeIntel.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/autobuild.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/autocomplete.py
>>>  ['hdevtools', 'admin', '--status']
>>>  ['ghc-mod', 'lang']
>>>  ['ghc', '--make', u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/CabalInspector.hs', '-o', u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/CabalInspector', '-outputdir', u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/obj/CabalInspector']
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/cabalbuild.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/cache.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/ghci.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/ghcmod.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/haskell_docs.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/haskell_type.py
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "./autocomplete.py", line 707, in run
  File "./autocomplete.py", line 757, in init_ghcmod_completions
    autocompletion.language_completions = call_ghcmod_and_wait(['lang']).splitlines()
  File "./sublime_haskell_common.py", line 388, in call_ghcmod_and_wait
    output_error(sublime.active_window(),
RuntimeError: Must call on main thread, consider using sublime.set_timeout(function, timeout)

>>>  ['ghc', '--make', u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/ModuleInspector.hs', '-package', 'ghc', '-o', u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/ModuleInspector', '-outputdir', u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/obj/ModuleInspector']
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/hdevtools.py
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./hdevtools.py", line 88, in start_server
    if not is_running():
  File "./hdevtools.py", line 81, in is_running
    r = admin(['--status'], wait = True)
  File "./hdevtools.py", line 72, in admin
    (exit_code, stdout, stderr) = call_and_wait(command, **popen_kwargs)
  File "./sublime_haskell_common.py", line 94, in call_and_wait
  File "./sublime_haskell_common.py", line 137, in call_and_wait_with_input
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

>>>  ['hdevtools', 'admin', '--status']
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/parseoutput.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/stylishhaskell.py
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./hdevtools.py", line 88, in start_server
    if not is_running():
  File "./hdevtools.py", line 81, in is_running
    r = admin(['--status'], wait = True)
  File "./hdevtools.py", line 72, in admin
    (exit_code, stdout, stderr) = call_and_wait(command, **popen_kwargs)
  File "./sublime_haskell_common.py", line 94, in call_and_wait
    return call_and_wait_with_input(command, None, **popen_kwargs)
  File "./sublime_haskell_common.py", line 137, in call_and_wait_with_input
    **popen_kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/sublime_haskell_common.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/symbols.py
Reloading plugin /Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeLinter/SublimeLinter.py
imported capp_lint
imported pep8
imported pyflakes
imported pyflakes.api
imported pyflakes.checker
imported pyflakes.messages
imported pyflakes.reporter
SublimeLinter: C loaded
SublimeLinter: c_cpplint loaded
SublimeLinter: CoffeeScript loaded
SublimeLinter: CSS loaded
SublimeLinter: Git Commit Message loaded
SublimeLinter: Ruby Haml loaded
SublimeLinter: HTML loaded
SublimeLinter: Java loaded
SublimeLinter: JavaScript loaded
SublimeLinter: Lua loaded
SublimeLinter: Annotations loaded
SublimeLinter: Objective-J loaded
SublimeLinter: Perl loaded
SublimeLinter: PHP loaded
SublimeLinter: Puppet loaded
SublimeLinter: Python loaded
SublimeLinter: Ruby loaded
SublimeLinter: pylint loaded
SublimeLinter: XML loaded
plugin init time: 1.47931
loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
pre session restore time: 1.73201
using gamma: 1 (err: 0)
startup cache, total files: 109 cache hits: 109
startup time: 1.89587 (package setup was not run)
loaded 844 snippets
Package Control: Skipping automatic upgrade, last run at 2013-03-17 00:28:30, next run at 2013-03-17 01:28:30 or after
Writing file /Users/scott/Code/eq/eqord.hs with encoding UTF-8
Sublime Haskell: reinspecting project (/Users/scott/Code/eq)
>>>  [u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/CabalInspector', u'/Users/scott/Code/eq/eq.cabal']
>>>  [u'/Users/scott/Library/Application Support/Sublime Text 2/Packages/SublimeHaskell/CabalInspector', (u'eq', u'/Users/scott/Code/eq/eq.cabal')]
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "./autocomplete.py", line 902, in run
  File "./autocomplete.py", line 944, in _refresh_all_module_info
  File "./autocomplete.py", line 995, in _refresh_module_info
  File "./sublime_haskell_common.py", line 336, in get_source_dir
  File "./sublime_haskell_common.py", line 94, in call_and_wait
  File "./sublime_haskell_common.py", line 137, in call_and_wait_with_input
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
TypeError: coercing to Unicode: need string or buffer, tuple found

Sublime Haskell: time to get completions: 0.000248 seconds
Sublime Haskell: time to get completions: 9.90000000001e-05 seconds
Sublime Haskell: time to get completions: 0.000367 seconds
Sublime Haskell: time to get completions: 0.00038 seconds
Sublime Haskell: time to get completions: 0.000392 seconds
Sublime Haskell: time to get completions: 0.000362 seconds
Sublime Haskell: time to get completions: 0.000384 seconds
Sublime Haskell: time to get completions: 0.000405 seconds
Sublime Haskell: time to get completions: 0.000345 seconds
Sublime Haskell: time to get completions: 0.000426 seconds
Sublime Haskell: time to get completions: 0.000440999999999 seconds
Sublime Haskell: time to get completions: 0.000194 seconds
Sublime Haskell: time to get completions: 0.000355 seconds
Sublime Haskell: time to get completions: 0.000442 seconds
Sublime Haskell: time to get completions: 0.000455 seconds
Sublime Haskell: time to get completions: 0.0003 seconds
Sublime Haskell: time to get completions: 0.000323 seconds
Sublime Haskell: time to get completions: 0.000313999999999 seconds
Sublime Haskell: time to get completions: 0.000263 seconds
Sublime Haskell: time to get completions: 0.00027 seconds
Sublime Haskell: time to get completions: 0.000266 seconds
Sublime Haskell: time to get completions: 0.000267999999999 seconds
Sublime Haskell: time to get completions: 0.000120000000001 seconds
Sublime Haskell: time to get completions: 0.000132 seconds
Sublime Haskell: time to get completions: 0.000267999999999 seconds
Sublime Haskell: time to get completions: 0.000266 seconds
Sublime Haskell: time to get completions: 0.000262 seconds
Sublime Haskell: time to get completions: 0.00026 seconds
Sublime Haskell: time to get completions: 0.000137 seconds
Sublime Haskell: time to get completions: 0.000123 seconds
Sublime Haskell: time to get completions: 0.000121 seconds
Writing file /Users/scott/Code/eq/eqord.hs with encoding UTF-8
Sublime Haskell: running build commands: [['cabal', 'build'], ['cabal', 'build', '--ghc-options=-fforce-recomp -Wall -fno-code']]
>>>  ['cabal', 'build']
>>>  ['cabal', 'build', '--ghc-options=-fforce-recomp -Wall -fno-code']
Sublime Haskell: total time to mark 0 diagnostics: 0.000555 seconds
Sublime Haskell: time to get completions: 0.000163 seconds
Writing file /Users/scott/Code/eq/eqord.hs with encoding UTF-8
Sublime Haskell: running build commands: [['cabal', 'build'], ['cabal', 'build', '--ghc-options=-fforce-recomp -Wall -fno-code']]
>>>  ['cabal', 'build']
>>>  ['cabal', 'build', '--ghc-options=-fforce-recomp -Wall -fno-code']
Sublime Haskell: total time to mark 0 diagnostics: 0.000473 seconds

Show symbol info gives invalid results and exception

When I use attoparsecs skipMany somewhere and run Show symbol info on it, I get a list that looks like:

  • Data.Vector.Unboxed.skipMany
  • Data.List.skipMany
  • ...

Those are invalid, something seems to be mixed up there. And if I choose them, nothing happens.

If I choose the right one:

  • Data.Attoparsec.ByteString.skipMany

I get a

Traceback (most recent call last):
  File "./autocomplete.py", line 512, in on_candidate_selected
  File "./autocomplete.py", line 527, in show_symbol_info
AttributeError: 'NoneType' object has no attribute 'name'

Interfering suggestions with parameters

As the standard SublimeText workflow suggests, I use suggestions to simply insert a title, but SublimeHaskell's new intrusive suggestions with parameters override that behaviour and ruin it by forcing me to clean up the unneeded parameters after using it.

See this video for more details:
http://screencast.com/t/tYGsP0h7U6c

This is obviously a misfeature, I suggest to remove it. Please don't take the path of making the plugin too smart to be usable. That was exactly the reason why I stopped using Intellij IDEA one day, and I think I'm hardly alone in that.

Project build chooser keeps popping up even if files are closed

@mvoidex The build chooser is very useful, but once you have loaded a file from a different project into Sublime, it keeps popping up, even if you have closed all files from that project.

Could we check if there are actually tabs from that project open before showing it and remove the project from the list of buildable projects when there is none?

Source code check fails if path contains spaces

The plugin only outputs "Build FAILED" when I try to run a check on source files located in directories with space characters in it's name.

Yes, I am using one of those new fancy-pants operating systems with support for spaces in folder names. Isn't it mind-blowing? :P

SublimeHaskell: Failed to compile ModuleInspector

Recently I've got this error:

SublimeHaskell: Failed to compile ModuleInspector

/home/m0nhawk/.config/sublime-text-2/Packages/SublimeHaskell/ModuleInspector.hs:185:46:
    Not in scope: `Doc.documentationDoc'

/home/m0nhawk/.config/sublime-text-2/Packages/SublimeHaskell/ModuleInspector.hs:194:19:
    Not in scope: data constructor `Doc.DocWarning'
    Perhaps you meant `Doc.DocString' (imported from Documentation.Haddock)

Using Sublime Text 2 under Fedora 18.

Highlight errors found by ghc-mod check

Currently we only support error hightlighting with cabal. We also want to support ghc-mod check.

We already get its result back and have ghc-mod lint implemented; we just have to parse the check lines and highlight them.

We might only do this if we are not in a cabal project since cabal build is always better. However, ghc-mod is much faster, maybe we should use it first on the current file and use cabal afterwards if no error?

cabal-dev config

Does anyone have an example of what to setup to get cabal-dev to work.

Getting

Exception in thread Thread-163:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 484, in run
self.__target(_self.__args, *_self.__kwargs)
File "./ghcmod.py", line 111, in wait_ghcmod_and_parse
File "./sublime_haskell_common.py", line 428, in call_ghcmod_and_wait
Exception: ghc-mod exited with status 1 and stderr: ghc-mod: user error (packages-7.4.2.conf not found)

Thanks

Dependency on ghc-mod causes Sublime to not start after modal dialogue

This is basically never correct behavior for a plugin to prevent the application from running. Because Hackage is down, I can't install ghc-mod, and because Sublime Haskell was automatically updated to have this dependency, I now have to figure out how to manually uninstall it so I can continue writing code. ._.

Override default comment to "-- "

Sublime's default comments for Haskell are --. We should override that to -- (with a space) since without a space is not correct in all cases (e.g. if there is a special character afterwards, say #).

Fixing the syntax highlighter

With 98d1f3d I just added a way we can fix the built-in Haskell syntax highlighting lexer, and the first fixed issue is 561fc63.

We should collect what other things are wrong with the default lexer, and fix them.

The first thing that comes to my mind:

  • If an import with import list doesn't have the bracket on the same line, imported functions are not highlighted:
import Data.List
    (sort, nub) -- <- not coloured!

Any other things that are wrong with the syntax highlighting?

Bug: Build commands show quick panel for single projects

I'm seeing this happen after mvoidex's Dec 18th commit to prompt on build.

Unless I'm mistaken, it looks like in cabalbuild.py, it should return after:

50   +    if len(ps) == 1: # There's only one project, build it
51   +        run_selected(ps[0])
52   +

...otherwise, it'll fall through and show the quick panel (w/ only one project) and run the command again upon selection.

Sublime Text 3

Hi and thanks for this project.
I have the following error with the new version of sublime text 3 :

reloading plugin SublimeHaskell.sublime_haskell_common
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 65, in reload_plugin
    m = importlib.import_module(modulename)
  File "X/importlib/__init__.py", line 88, in import_module
  File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1023, in load_module
  File "<frozen importlib._bootstrap>", line 1004, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 854, in _load_module
  File "<frozen importlib._bootstrap>", line 981, in get_code
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/Users/ouvasam/Library/Application Support/Sublime Text 3/Packages/SublimeHaskell/sublime_haskell_common.py", line 261
    except OSError, e:
                  ^
SyntaxError: invalid syntax

Add haskell-docs integration

There is a new command-line tool called haskell-docs that can show docs for a function. To quote Christopher Done:

λ> :doc Data.List.Split split
Split a list according to the given splitting strategy. This is
 how to "run" a Splitter that has been built using the other
 combinators.
λ> :doc Control.Concurrent.MVar swapMVar
Take a value from an MVar, put a new value into the MVar and
 return the value taken. This function is atomic only if there are
 no other producers for this MVar.
λ> :doc Data.List sort
Ambiguous module, belongs to more than one package: base haskell2010-1.1.0.1
Continuing anyway...
Package: base
The sort function implements a stable sorting algorithm.
 It is a special case of sortBy, which allows the programmer to supply
 their own comparison function.

We should integrate this so that we can show docs about the word under the cursor (or open them in a web browser).

Probably we have to get the module name the function comes from for this; I guess ghc-mod will do that for us.

Cabal test

What's the best way to wire up running 'cabal test' via a keyboard shortcut ?

Is it in the the build already somehow ?

Thanks

Semi-random crash

I find it hard to consistently reproduce this bug with other files, but I got a file in one of my projects (https://github.com/arianvp/Haskeme/blob/develop/src/Language/Haskeme/AST.hs)

and if I try to edit it after saving, SublimeText will crash after typing more than one letter. It doesn't happen on space or newline, so it seems auto-completion related. After uninstalling SublimeHaskell the problem doesn't occur.

how to repdroduce:

  • open project with sublime-text. Type some text in AST.hs and all will go fine.
  • save AST.hs and enter any character. SublimeText will halt

I'll try to get some more info later. Any idea how I can debug ST, to see where the scripts seem to hang?

SublimeHaskell ignores settings inside "Settings -- User"

I was long trying to figure out why do I get:

SublimeHaskell: ghc-mod was not found!

After digging inside plugin's code, it turned out, that SublimeHaskell only loads settings from SublimeHaskell.sublime-settings. I'm not sure if this is intended (or I understood sources right), but it doesn't seem to be explicitly and obviously.

So, if this is done by intent, we should extend error-message to explicitly mention that setting add_to_PATH need to be added into SublimeHaskell.sublime-settings file, and that it should be a list of paths (I'd suggest renaming setting to something like extend_PATH_list).

If this is not by intent, SublimeHaskell should be upgraded to be able to read Default and User-settings also.

Thanks!

Failed to compile ModuleInspector

I have used SublimeHaskell for a while. It worked great.
However, from yesterday, it pops up error every time I open an .hs file.
The problem is as follows,

SublimeHaskell: Failed to compile ModuleInspector
: cannot satisfy -package ghc:
ghc-7.4.2-4d621e5746c71550932a5560f8262148 is unusable due to missing or recursive dependencies:
Cabal-1.14.0-194bfc2d12c4cba2ab28a76878f3517c
Win32-2.2.2.0-6698dcca54558470959f97f13257fe4a
bin-package-db-0.0.0.0-cfc410411181006ff7b5fdee59d9630d
bytestring-0.9.2.1-0c74e8abeebb3c3d794fd93f5313ffd8
directory-1.1.0.2-58fafe7d1531ce2e3ca938d86c37c9bd
hpc-0.5.1.1-35a34050038a430c3e688eacfd7362e8
process-1.1.0.1-fe3d67a3840d8aa72e483e86efef85a4

(use -v for more information)

Would someone suggest me how to fix this problem? Thank you.

Doesn't find modules installed with cabal in Win7

Whenever I am importing a module that I have installed locally with cabal, the auto-checking feature of SublimeHaskell flags it as an unknown module

image

I have tested this with multiple different modules that I have installed, and it occurred with all of them. An interesting thing to note is that if I have multiple imports for cabal-installed modules, it only flags the last one on the list, even if the imports are separated by core module imports (i.e. Data.List). My code still compiles just fine from the command line, both ghc and ghci recognize the modules.

I know one solution might be to install the modules globally, but that is not an ideal fix for my environment.

Turning off the ModuleInspector per-project

I have one really big project on which the ModuleInspector runs 20 minutes.

I'd like to disable it for that.

Do you know if we can make project-specific SublimeHaskell settings in .sublime-project?

Problems with Unicode source files

When I save a file in a Cabal project, it auto builds it and I got errors such as

C:\path\to\HeatMap.hs: line 31, column 24:
  Warning: This binding for `<stderr>: hPutChar: invalid argument (invalid character)

Build FAILED

If instead I explicitly run SublimeHaskell -> Check I got the right output

C:\path\to\HeatMap.hs: line 31, column 24:
  Warning: This binding for `λ' shadows the existing binding
             bound at C:\path\to\HeatMap.hs:24:17

If I try to run ghc-mod --check HeatMap.hs from command line I got

C:\path\to\HeatMap.hs:31:24:Warning: This binding for `╬╗' shadows the existing binding            bound at C:\path\to\HeatMap.hs:24:17

but if I set the right codepage with chcp 65001 I get again

C:\path\to\HeatMap.hs:31:24:Warning: This binding for `λ' shadows the existing binding            bound at C:\path\to\HeatMap.hs:24:17

The source is something like

waveLengthToRGB λ = ... -- Line 24
  where
  ...
  computeInitialValues λ = ... -- Line 31

Most Recent Commit: Failed to compile ModuleInspector

This message shows up when startup sublimetext:

SublimeHaskell: Failed to compile ModuleInspector

C:\Users\Prince\AppData\Roaming\Sublime Text 2\Packages\SublimeHaskell\ModuleInspector.hs:200:19:

    Not in scope: data constructor `Doc.DocHyperlink'

C:\Users\Prince\AppData\Roaming\Sublime Text 2\Packages\SublimeHaskell\ModuleInspector.hs:200:55:

    Not in scope: `Doc.hyperlinkUrl'

C:\Users\Prince\AppData\Roaming\Sublime Text 2\Packages\SublimeHaskell\ModuleInspector.hs:200:79:

    Not in scope: `Doc.hyperlinkLabel'

C:\Users\Prince\AppData\Roaming\Sublime Text 2\Packages\SublimeHaskell\ModuleInspector.hs:203:19:

    Not in scope: data constructor `Doc.DocProperty'

The plugin is working properly though. What should I do?
I have installed haddock, otherwise the whole thing wouldn't compile.

Also, modules are loaded correctly, after the first time compilation which took about 100s. Now they are loaded instantly, thanks for the excellent work.

Sublime Haskell: loading standard modules info for cabal within 0.0746378262111 seconds

not enough documentation !!

  1. how do i use stylish-haskell ?

  2. what prompts lines of code to be highlighted in green?

  3. how can i have a command rather than just on file save trigger building things?

other stuff i'm not away of? :)

Hang on input

Some pretty weird hanging happens on editing Haskell source. Here's a screencast showcasing the issue.

Removing SublimeHaskell package solves the issue.

I have only started experiencing this issue just now, and I'm using SublimeText to program in Haskell daily.

Specifying cabal-dev sandbox

Hi, leaving the setting cabal_dev_sandbox as "" doesn't use the cabal-dev default of using 'cabal-dev' under the current working directory.

Setting cabal_dev_sandbox appears only to work in the sublime haskell user settings file. Not when in the project file settings.

Hence I can't have a sandbox per project defined. Am I missing something ?

Thanks

Go to any declaration throws exception

When I use Go to any declaration I get:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 339, in run_
  File "./autocomplete.py", line 357, in run
AttributeError: 'NoneType' object has no attribute 'line'

Issues getting build to work

Hi, have a project that used cabal-dev under eclipse fp but wanted to try sublime out as a dev env.

All installed with pre-reqs but something seems to be wrong. When I deliberately put an error in it seems to indicate it's being worked on but a tick appears and no error inline or in any output window I can find.

This is under osx, project all works on command line with a terminal. Any tips to diagnose the issue ??

Also do you integrate to the build system ? What's the recommend way of running your app / test ? Just putting a direct link to the exec or running cabal test ?

Thanks

Exception on missing hdevtools

Lacking hdevtools, I get

Exception in thread Thread-13:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\threading.py", line 484, in run
  File "./hdevtools.py", line 88, in start_server
    if not is_running():
  File "./hdevtools.py", line 81, in is_running
  File "./hdevtools.py", line 72, in admin
  File "./sublime_haskell_common.py", line 94, in call_and_wait
  File "./sublime_haskell_common.py", line 136, in call_and_wait_with_input
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 1139, in _execute_child
OSError: [Errno 2] No such file or directory

We should check for this properly and print something like devtools not found, skipping support - install it with cabal install hdevtools instead.

Make a difference between ghc-mod warnings and errors

We show "build failed" even on warnings only.

show_output_result_text shouldn't decide wether to show the panel or not based on exit_code - the caller should decide whether the panel is visible or not.

Also, show_output_result_text handles the status bar which is misleading.

Minor exception on startup

Doesn't seem to affect anything, but I thought It'd better be reported.
I happened to open the console, then saw this:

Reloading plugin C:\Users\Prince\AppData\Roaming\Sublime Text 2\Packages\SublimeHaskell\haskell_type.py
Exception in thread Thread-8:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\threading.py", line 484, in run
  File ".\hdevtools.py", line 92, in start_server
  File ".\hdevtools.py", line 85, in is_running
    r = admin(['--status'], wait = True)
  File ".\hdevtools.py", line 76, in admin
  File ".\sublime_haskell_common.py", line 102, in call_and_wait
  File ".\sublime_haskell_common.py", line 144, in call_and_wait_with_input
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 842, in _execute_child
WindowsError: [Error 2]

among lots of "reloading" stuff

SublimeHaskell: Failed to compile ModuleInspector

This messages shows up on start-up:

SublimeHaskell: Failed to compile ModuleInspector

C:\Users\@@@\AppData\Roaming\Sublime Text 2\Packages\SublimeHaskell\ModuleInspector.hs:11:18:

Could not find module `Language.Haskell.Exts'

Perhaps you meant

  Language.Haskell.Lexer (from haskell-src-1.0.1.5)

  Language.Haskell.TH (from template-haskell)

  Language.Haskell.Parser (from haskell-src-1.0.1.5)

Use -v to see a list of the files searched for.

I'm new to haskell. Can anyone tell me what I need to do to fix this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.