Code Monkey home page Code Monkey logo

vscode-ghc-simple's Introduction

Simple GHC (Haskell) Integration for VSCode

Icon

Simple Haskell support using only GHCi.

vscode-ghc-simple on Visual Studio Marketplace CircleCI

Installation

Get vscode-ghc-simple from the Visual Studio Marketplace or run the following in Quick Open:

ext install dramforever.vscode-ghc-simple

Alternatively, if you want the latest and greatest, you can download vsix files from Circle CI. Pick the latest build, and check out the 'Artifacts' tab.

What?

This VSCode extension provides editing enhancements for Haskell development.

Currently implemented features:

  1. Diagnostics: Basic squiggles and error messages. Automatic re-checking on save.

    Squiggle demo screenshot

  2. Completion: Crude completion with GHCi's :complete command, with :info lookup. Works okay with imported and top level identifiers.

    Completion demo screenshot

  3. Type: View types by selecting in the code. The minimal expression covering the selection will have its type shown. Implemented with :all-types.

    Range type demo screenshot

  4. Inline REPL: Add REPL blocks to your code with haddock syntax, either using no spaces before >>> or put it in a comment like -- >>>. Click on the code lens or type Shift+Enter to run a single block, or type Shift+Alt+Enter to run all blocks in a file.

    Inline REPL demo screenshot

  5. Definition and usages: See definitions amd references of identifiers. Supports both module level and local identifiers. Implemented with :loc-at and uses. Does not yet support identifiers imported from packages.

    Definition demo screenshot

Why?

Since around GHC 8, the compiler GHC and its interactive REPL GHCi has gained various tooling-related features. These allow for more tooling that communicate with the compiler using text IO and files, instead of a Haskell API. This project aims to explore the possibilities provided by said features, by implementing Haskell tooling within the editor VSCode.

Notes

Commands

  • vscode-ghc-simple.restart: Restart GHCi sessions

    vscode-ghc-simple currently lacks a way of detecting changes of critical configuration files such as stack.yaml or *.cabal. Run this command whenever, had you been running GHCi manually, you would restart it.

Configuration options

  • ghcSimple.feature.*: Feature switches

    Some users might want only a subset of the features provided in vscode-ghc-simple. These options can be used to disabled unneeded features.

  • ghcSimple.workspaceType: Workspace type

    Override workspace type detection and force a certain workspace type (e.g. stack or cabal).

    Normally, vscode-ghc-simple will try to detect whether to use Stack or Cabal, or use a plain GHCi. Change this option in your workspace settings to specify such a type manually.

    vscode-ghc-simple will default to Cabal new-style for workspaces with Cabal files.

  • ghcSimple.startupCommands.*: GHCi Startup commands

    Commands to run at GHCi startup. Configures some common options.

    Two of the command lists are semantically meant to configure GHCi for use by vscode-ghc-simple:

    • all: Commands for all workspaces
    • bare: Commands for standalone files (bare workspaces)

    If you need to add more commands, it's suggested that you do so using the following command list, so that the previous to can be updated as needed in newer versions of vscode-ghc-simple:

    • custom: Custom commands for all workspaces

    Change the options in workspace settings instead of user settings if you want to apply the settings to a workspace locally.

  • ghcSimple.useObjectCode: Speed up GHCi reloads using -fobject-code

    Enabled by default. Load everything with -fobject-code first before loading needed files with -fbyte-code. This way only changed files need to be recompiled, which greatly speeds up GHCi on large projects.

  • ghcSimple.maxCompletions: Maximum number of completion items to show.

  • ghcSimple.inlineRepl.codeLens: Show code lens for GHCi REPL blocks

    Disable this if you don't like 'Run in GHCi' code lens littered around your files. If you disable the inline repl feature using ghcSimple.feature.inlineRepl you will also not see code lens.

vscode-ghc-simple's People

Contributors

dramforever avatar edmundnoble avatar

Watchers

James Cloos avatar

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.