Visual Studio Code Haskell



Visual Studio Code(简称VS Code)是一个由微软开发,同时支持Windows 、 Linux和macOS等操作系统且开放源代码的 代码编辑器,它支持测试,并内置了Git 版本控制功能,同时也具有开发环境功能 ,例如代码补全(类似于 IntelliSense)、代码片段和代码重构等,该编辑器支持用户个性化配置,例如改变主题颜色. Visual Studio Code, Emacs+haskell-mode, and Emacs are probably your best bets out of the 10 options considered. This page is powered by a knowledgeable community that helps you make an informed decision. Visual Studio Code: DevContainer for Haskell What is this. This is a DevContainer environment for Visual Studio Code, allowing automatically installing the Haskell compiler (GHC), Stack, Cabal, HLS (Haskell Language Server), and the necessary Visual Studio Code extensions to set up a Haskell development environment with zero additional effort. VS Code is a general code/scripting IDE built to be lightweight and for people familiar with their language of choice, not directly comparable to Visual Studio in power or scope. Code Runner is an extension that enables you to run any language’s code snippets in Visual Studio Code, with support for every popular programming language including both legacy languages and those that have gained popularity in recent years such as Clojure, Objective-C, Rust, Racket, AutoHotkey, AutoIt, and many others.

  1. Visual Studio Code Haskell
  2. Visual Studio Code Reference
Visual

This extension integrates ghci (the interactive Haskell shell) with Visual Studio Code. This allows for auto-reloading on file change and more.

How to use

To open an interactive shell, simply right click in your Haskell source file and click on Open interactive shell. Alternatively click the yellowish/orange Haskell logo in the top right corner of the editor to open/close the interactive shell, or just type the commands into the command palette.

The shell runs in the vscode integrated terminal and automatically switches when you change the current file. To close the shell you can close it as you would any other terminal window by clicking the little trash can, or you can of course type :quit into it.

Commands

  • Haskell: Open interactive shell -- Open an interactive shell with the current file loaded.
  • Haskell: Close interactive shell -- Close the shell tied to the current file.
  • Haskell: Toggle interactive shell -- Self explanatory.
Visual studio code haskell

Requirements

Requires ghci to be installed. It probably is already if you use Haskell. If it's not and you don't know where to start the best place is probably haskell.org/downloads.

Note: Depending on how you may have installed ghci, you might have to modify the haskellShell.ghci.executablePath setting in your vscode configuration file.

Known Issues

  • There are issues but I don't know about them.

Possible additions and changes

  • Find a way to decouple the interactive shell from the vscode integrated terminal, so that the user can have a shell and a terminal open at the same time. I've thought about maybe using webviews, however this could be bad for performance and probably not worth the complexity.
  • I want to add the ability to open a shell that is tied to multiple files. I don't know how this would be implemented design-wise.

Visual Studio Code Haskell

Release History

Visual Studio Code Reference

0.0.2

Visual studio code haskell plugin
  • Change: Smaller icons.
  • Change: No longer clear interactive shell every time file is saved.
  • Fix: Files with spaces in their absolute path couldn't be opened in the interactive shell.

0.0.1

  • Initial release