• Stars
    star
    168
  • Rank 225,507 (Top 5 %)
  • Language ReScript
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

agda-mode on VS Code

agda-mode on VS Code

Installation

If you have Agda properly installed (to check this in your terminal, type agda and see if it's on your machine). Open an Agda file and you should be able to load it by typing C-c C-l.

It's okay if you don't have Agda installed, just proceed to the next section and check out our experimental language server for Agda.

Agda Language Server

Simply enable agdaMode.connection.agdaLanguageServer in the settings, and then hit restart C-x C-r.

The language server should be downloaded and installed within seconds.

ๆˆชๅœ– 2021-08-30 ไธ‹ๅˆ10 22 29

Prebuilt binaries for the language server are available on Windows, macOS, and Ubuntu.

Extension Activation

To activate the extension, open an Agda file, and trigger either of these 2 commands:

Command Keymap
load C-c C-l
activate unicode input method \

See the next section for the exhaustive list of other commands. You will get command ... not found if you try to trigger other commands without activating the extension first.

Commands

  • C-c stands for "press Ctrl and c at the same time"
  • When it comes to combos like C-c C-l, you can often slur them into "hold Ctrl while pressing c and then l"

Commands working with types (marked with the ๐ŸŽš emoji below) can have different levels of normalization. However, due to some technical limitations, we cannot prefix commands with C-u or C-u C-u like in Emacs. Instead, we replace the C-u C-c prefix with C-u and the C-u C-u C-c prefix with C-y.

Take infer type for example:

Level of normalization Keymap in VS Code Keymap in Emacs
"simplified" (default) C-c C-d C-c C-d
"instantiated" (without further normalisation) C-u C-d C-u C-c C-d
"normalized" (fully normalized) C-y C-d C-u C-u C-c C-d

Global commands

Command Keymap
load C-c C-l
compile C-x C-c
quit C-c C-q
quit and restart C-x C-r
toggle display of hidden arguments C-x C-h
toggle display of irrelevant arguments C-x C-i
show constraints C-c C-=
solve constraints ๐ŸŽš C-c C-s
show all goals C-c C-?
move to next goal (forward) C-c C-f
move to previous goal (backwards) C-c C-b
infer type ๐ŸŽš C-c C-d
module contents ๐ŸŽš C-c C-o
search definitions in scope ๐ŸŽš C-c C-z
compute normal form (default compute) C-c C-n
compute normal form (ignore abstract) C-u C-n
compute normal form (use show instance) C-y C-n
switch to a different Agda version C-x C-s
Unicode symbol input sequences lookup C-x C-=

Commands in context of a goal

Command Keymap
give (fill goal) C-c C-SPC
refine C-c C-r
elaborate and give ๐ŸŽš C-c C-m
auto C-c C-a
case split C-c C-c
compute helper function type and copy ๐ŸŽš C-y C-h
goal type ๐ŸŽš C-c C-t
context (environment) ๐ŸŽš C-c C-e
infer type ๐ŸŽš C-c C-d
goal type and context ๐ŸŽš C-c C-,
goal type, context and inferred term ๐ŸŽš C-c C-.
goal type, context and checked term ๐ŸŽš C-c C-;
module contents ๐ŸŽš C-c C-o
compute normal form (default compute) C-c C-n
compute normal form (ignore abstract) C-u C-n
compute normal form (use show instance) C-y C-n
why in scope C-c C-w

Commands yet to be implemented

Command Keymap
abort a command C-x C-a
remove goals and highlighting C-x C-d
comment/uncomment rest of buffer

Unicode Input

Pretty much the same like on Emacs. Press backslash "\" and you should see a keyboard popping up in the panel, with key suggestions and symbol candidates. Use arrow keys to explore and navigate between the candidates (if there's any).

Unicode input also works in the input prompt, though it's a bit less powerful.

If you are having trouble typing the backslash "\", you can change it by:

  1. Go to "Preferences: Open Keyboard Shortcuts" and configure the keybinding of "Agda: Activate input method" (agda-mode.input-symbol[Activate]).
  2. Go to "Settings > Agda Mode > Input Method: Activation Key" and replace it with the same keybinding as above.

Cancel agdaMode.inputMethod.enable in the settings to disable the input method.

Syntax Highlighting

Cancel agdaMode.highlighting.getHighlightWithThemeColors in the settings if you want to fallback to the old way of highlighting stuff with fixed colors.

Debug Buffer

Execute Agda: Open Debug Buffer in the Command Palette to open it. The number at the end of each message indicates its verbosity.

Troubleshooting

Agda files won't load, commands don't work

Please go to "Preferences: Open Keyboard Shortcuts" and see if any extension is fighting for the same key combo. You're probably a victim of the Vim extension.

"Give" command not working on macOS

Give (C-c C-SPC) would trigger "Spotlight" (C-SPC) on Mac. Please consider using Refine (C-c C-r) instead.

Contributing

See CONTRIBUTING.md

More Repositories

1

agda-mode

agda-mode on Atom
Reason
58
star
2

socket.io-haskell

socket.io for haskell folks
Haskell
23
star
3

Hakaru-FLOLAC16

Some materials for "The taste of probabilistic programming and modeling" by Oleg Kiselyov at FLOLAC'16
Haskell
16
star
4

language-agda

Agda language support for the Atom editor
13
star
5

rescript-vscode

ReScript bindings for the VS Code API
ReScript
13
star
6

formal-language

Curryโ€“Howard Correspondence for fun
Haskell
11
star
7

edis

typed redis
Haskell
5
star
8

docker-agda

Agda on Docker
Dockerfile
4
star
9

nodejs-hinet-sms

node.js hinet-sms protocol implementation
JavaScript
3
star
10

agda-mode-st3

deprecated
Python
3
star
11

mini-pascal

mini-pascal
Haskell
3
star
12

relais

Haskell
2
star
13

kern

Minimalistic Node.js client for Redis
JavaScript
2
star
14

bidirectional

bidirectional typing stuff
Agda
2
star
15

ECGF

Elliptic curves over galois fields
C
2
star
16

Backbone.cache

localStorage cache for Backbone
JavaScript
1
star
17

evolutionary-computation

i like bacon
Haskell
1
star
18

dp-trial

Haskell
1
star
19

tube

JavaScript
1
star
20

categories

Learning Category Theory by constructing them in Agda
Agda
1
star
21

type-theory

Agda
1
star
22

cedar

cedar
JavaScript
1
star
23

keymap

Emacs Lisp
1
star
24

algorithmus

Rust
1
star
25

nineveh

Source-to-source stylesheet compiler
Haskell
1
star
26

numeral

TeX
1
star
27

linear-algebra

Agda
1
star
28

evo

Haskell
1
star
29

banacorn.github.com

meine github seite
1
star
30

Graphentheoretische-Paralleler-Algorithmus

Graphentheoretische Paralleler Algorithmus
Haskell
1
star
31

underscore-injection

Injects Underscore collection and array goodies right into your Array.prototype
1
star
32

language-server-mule

Rescript library for hauling language servers from your disk or somewhere else
ReScript
1
star
33

scorefour

Haskell
1
star