Giter VIP home page Giter VIP logo

vscode-idris's Introduction

Idris for Visual Studio Code

Version Installs Ratings

Build Status Build Status

Implemented features

command screenshot command name
Typecheck the currently open file idris.typecheck
Print the type of the identifier under the cursor idris.type-of
Print the documentation of the identifier under the cursor idris.docs-for
Print the definition of the identifier under the cursor idris.print-definition
List all active holes in the currently open file idris.show-holes
Generate an initial pattern match clause for the function under the cursor idris.add-clause
Generate an initial pattern match clause when trying a proof idris.add-proof-clause
Generate a case split for a pattern variable under the cursor idris.case-split
Attempt to fill out any holes by a proof search idris.proof-search
Create a pattern-matching with-rule for the name under the cursor idris.make-with
Create a case pattern match template for a hole under the cursor idris.make-case
Create a top-level function with a type matching the hole under the cursor idris.make-lemma
Search names, types and documentation idris.apropos
Evaluate the selected code idris.eval-selection
Start or refresh a REPL for the currently open file idris.start-refresh-repl
Send the selected code to the REPL idris.send-selection-repl
Cleanup all the idris binary files(*.ibc) in the project idris.cleanup-ibc
Create a new project with scaffolding idris.new-project
Search for functions by type signature idris.search

Heads up: All the commands above can also be triggered in the right-click menu

menu

Installation

  1. Within Visual Studio Code, open the command palette (Ctrl-Shift-P / Cmd-Shift-P).
  2. Select Install Extension and search for Idris or run ext install Idris.
  3. Download Idris and make sure the idris executable is on your PATH.
  4. Run cabal install idringen and make sure the idrin executable is on your PATH.

Contributing

Check out CONTRIBUTING.md.

Options

The following Visual Studio Code settings along with their default values that are available for the Idris extension. If you want to change any of these, you can do so in user preferences (cmd+,) or workspace settings (.vscode/settings.json). You don't have to copy these if you don't intend to change them.

{
    "idris.executablePath": "idris",            // The full path to the idris executable.
    "idris.hoverMode": "fallback",              // Controls the hover behavior. 'info' will display Idris documentation, 'type' will display Idris type, 'fallback' will try 'info' first and fallback to 'type' if we can not get the documentation, and 'none' will disable hover tooltips.
    "idris.suggestMode": "allWords"             // Controls the auto-completion behavior. 'allWords' will always include all words from the currently opened documentation, 'replCompletion' will get suggestions from Idris REPL process.
    "idris.warnPartial": false                  // Show warning when a function is partial.
    "idris.showOutputWhenTypechecking": false   //Show output channel when typechecking finished.
    "idris.numbersOfContinuousTypechecking": 10 //Kill Idris process every N times of continuous typechecking to avoid memory leaking.
}

Acknowledgements

Thanks

  • Belleve Invis @be5invis (The maintainer of the syntax files)

License

BSD 3-Clause, the same as Idris.

vscode-idris's People

Contributors

be5invis avatar finnnk avatar philipcraig avatar wkwkes avatar zjhmale 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

vscode-idris's Issues

Syntax : fix Effect labels

sample:

module Main

import Effects
import Effect.State

TC : Type -> Type
TC a = Effects.SimpleEff.Eff a ['bindings ::: STATE (List (Pair String Int)),
                                'counter ::: STATE Int]

incrCounter : TC Int
incrCounter = do
    n <- 'counter :- get
    'counter :- put (n + 1)
    pure n

newMetaTypeVar : TC String
newMetaTypeVar = do
    n <- incrCounter
    pure ("Meta" ++ show n)


main : IO ()
main = do
    s <- runInit ['bindings := [], 'counter := 1] newMetaTypeVar
    print s

Better representations of errors

Highlight Output Channel is pending on upstream issues:

microsoft/vscode#586
microsoft/vscode#11005

The original approach e3a1d6c to fix this can highlight messages in output channel indeed, but it will override some default behaviors of the output channel, e.g. we can no longer click the links inside output channel, even use registerDocumentLinkProvider

Another hacky approach html_views

hover-type text should use ligatures and Hasklig font if they are set up

The editor windows look great with the Hasklig font set up and editor.fontLigatures turned on.

One difference to the Haskell ghc-mod vscode extension is that the hover type messages in the Haskell one respect the ligature setting and show hover ligatures, but the Idris one currently doesn't.

Have option to show :doc and fallback to :type

Another feature request copied from https://github.com/hoovercj/vscode-ghc-mod

It has a preference: haskell.ghcMod.onHover, which can be set to fallback mode where it does :info, then falls back to type if :info returns nothing.

My request is to have a fallback mode for vscode-idris, that shows the :doc output on type-hover.

That way the user sees the richest possible information on type hover.

Function parameter type hints

https://code.visualstudio.com/docs/extensionAPI/vscode-api#SignatureHelpProvider

Since Haskell-like syntax does not have parenthesis and commas for functions, things may get tricky here. If use some backtracking to find the nearest function definition, a big overhead of trying to get type information of each identifier in the backtracking path stands there. This feature seems to be impossible to be implemented at present. On a second thought, if we can backtracking to find the nearest function and to match the number of arguments can still finish the job.

And the case to support signature hint for function call inside parenthesis e.g. (fun arg...) is much more straightforward.

- [ ] signature hint for open function calls There is partial evaluation stands there, e.g., map ฦ’ ... so it will be crazy complicate and hard to give a 100% promise of precise, support for close functions is best we can do here for parameter type hints.

  • signature hint for close function calls

Can't type check any code

First of all, thanks for working on this extension. I'm just experimenting with VS Code and was happy to see some Idris support.

Unfortunately, I haven't been able to get much of anything working. After installing the extension, I opened an existing project of mine and tried to type check it. When I execute the type checking function, however, absolutely no output is shown. I added deliberate type errors and still did not see any output.

Unable to debug this, I created an idris file with the following contents:

module Junk

data Test

When I try to get your extension to type check this code, I get an error popup reading Running the contributed command:'idris.typecheck' failed with no further information. This is more than I get for my larger file, but I'm still not sure what I'm doing wrong.

Any advice would be greatly appreciated. Idris is on my $PATH installed on OSX via homebrew.

Shortcut confliction

Since other sophisticated extensions are all released without carrying any default key bindings, so I'm just seriously considering about removing all the default key bindings for actions. Any ideas about this @be5invis

Completion improvement

  • Note for contribution to add item kind for :repl-completions command. Also, need to eliminate some speed overhead.

Currently, it will only suggest bare strings for auto-completion without any extra information e.g. item kind which mentioned above.

{"responseType":"return","msg":[[["locMessage"],""]]}
{"responseType":"return","msg":[[["show","showArg","showCon","showLitChar","showLitString","showParens","showPrec"],""]]}
{"responseType":"return","msg":[[["show"],""]]}
{"responseType":"return","msg":[[["show","showArg","showCon","showLitChar","showLitString","showParens","showPrec"],""]]}
{"responseType":"return","msg":[[["Unknown","UnknownImplicit"],""]]}
{"responseType":"return","msg":[[["show","showArg","showCon","showLitChar","showLitString","showParens","showPrec"],""]]}
  • Support auto-completion for all words in the open editor like javascript here.

For the second point, there is no external tools to analysis Idris source file currently, so a naive but straight forward way is to extract all the lexer identifier and add to the completion result list.

basic features

  • type of word
  • docs for word
  • case split
  • add clause
  • make with
  • make lemma
  • make case
  • show holes
  • proof search
  • type check file
  • print definition
  • REPL
  • apropos
  • completions

Add configuration for Idris executable

  • Add executable configuration.
  • When the executable path is changed, need to re-initialize.
  • If the executable path is invalid, do not initialize and show a proper error message.

Highlighting Type class and Data constructor

Currently, the type classes and data constructors are not highlighted.

image

And this is highlighting with the syntax file translated directly from the atom package.

image

Maybe we can go back to the old highlighting style? @be5invis

add a readme saying how to contribute

I've a couple of times wanted to send a pull request, but:

  1. I can't trivially see how to build and test the extension for myself. Add a document explaining this, plus any other requirements that must be met for a potential pull request to be considered
  2. (related) I suspect there might be some deployment/configuration files that aren't part of the repo. If so, could they be added?

The point is to lower the barrier to sending potentially useful pull requests

right-click shortcuts on some Idris commands

Enhancement request:

To make the plugin even more amazing, it would be great if the appropriate Idris commands were exposed via right-clicking in an identifier rather than only through the control-shift-p menu.

Issue with add clause command

screenshot

Happened when the current line is already at the last line in the opened editor. So does other commands which will generate code in the editor.

Possible memory leak?

I'm running idris 0.99.1 on OSX

Extension is awesome, but after using it for 45 minutes or so running commands (exercises in TDDII) slows down dramatically and there is an idris process using most of my system's RAM.

Workaround: Closing and opening VS Code every now and again.

Pass through idris' type-checking methods if hovertext fails

Show type on hover is now working (awesome!)

My issue is:

If the idris server's type-checking function fails, the error message shown in place of the hover type should show the Idris-server error message (which in my case was a warning that the .ibc files had been built with an older idris version and needed cleaning) rather than what it currently shows of "didn't load /path/to/file.idr"

Support more commands

  • IDE-Mode
  • :add-proof-clause d238beb
  • :add-missing
  • :who-calls
  • :calls-who
  • :browse-namespace 54c7eab
  • :normalise-term
  • :show-term-implicits
  • :hide-term-implicits
  • :elaborate-term
  • REPL

Find usage

we can use https://github.com/idris-lang/Idris-dev/blob/master/src/Idris/WhoCalls.hs command here, though it does not give any information about the line, column and file-path, but we can find all occurrences and then match the type signature to filter out all usages.

A sample result of this command:

{"responseType":"return","msg":[[[["TermLang.Unify.reifyExp",[[0,23,[[":name","TermLang.Unify.reifyExp"],[":implicit",false],[":decor",":function"],[":doc-overview",""],[":type","Int -> Val -> TC Exp"],[":namespace","TermLang.Unify"]]]]],[["TermLang.Unify.reifyEnv",[[0,23,[[":name","TermLang.Unify.reifyEnv"],[":implicit",false],[":decor",":function"],[":doc-overview",""],[":type","Int -> Env -> TC (List Exp)"],[":namespace","TermLang.Unify"]]]]],["TermLang.Unify.unify",[[0,20,[[":name","TermLang.Unify.unify"],[":implicit",false],[":decor",":function"],[":doc-overview",""],[":type","Val -> Val -> TC ()"],[":namespace","TermLang.Unify"]]]]]]]]]}

https://code.visualstudio.com/docs/extensionAPI/vscode-api#ReferenceProvider

Index symbol

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.