Coder Social home page Coder Social logo

kind-vscode's Introduction

kind-vscode

A Visual Studio Code plugin for the Kind programming language. This plugin provides output from the kind typechecker to VSCode.

Screenshot of the plugin displaying a diagnostic message

Architecture

A architecture diagram showing the high level components

This extension is structured as three pieces:

  • A vscode extension that launches kind-lsp
  • A language server, kind-lsp, that's written in node and contains the state
  • A set of functions for computing results, written in Kind.

Structure

.
├── client // Language Client
│   ├── src
│   │   ├── test // End to End tests for Language Client / Server
│   │   └── extension.ts // Language Client entry point
├── package.json // The extension manifest.
└── server // Language Server
    └── src
        └── server.ts // Language Server entry point

Getting Started

To install all of the necessary dependencies, run

npm install

In VSCode there is a launch configuration named "Launch Client" that will start an instance of VSCode with the plugin enabled.

Roadmap

The following features are planned:

  • Hover over a symbol to view its documentation
  • Jump to definition
  • Autocompletion
  • Rename symbol
  • Support for other editors, for example: Atom, vim

kind-vscode's People

Contributors

simonhorlick avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

racs4

kind-vscode's Issues

Create architecture document

Outline how the various pieces talk to each other.

vscode <> extension <> lsp server (javascript) <> formality (compiled to javascript)

Show documentation when hovering over functions

One key feature of the language server is to support contextual information via hovering over code. It's useful for developers to not only be able to see the types that a function deals with, but also it's documentation.

When hovering over String.flatten below:

      let str = String.flatten([err, "\n", hig]);

The user should be able to see something like:

String.flatten(xs: List(String)): String

flatten takes a List of Strings and concatenates them into a single String.

Show inferred types on hover

In the below screenshot, if a user hovers over b we should display its inferred type - i.e. Pair(Nat, String).

Screenshot 2021-03-08 at 1 19 09 PM

Watch the filesystem for changes to files

If files change on the filesystem, the language server should re-check those files. This can happen if the file is edited outside of the editor or if a tool like git modifies the files.

This plugin should rely on the lsp client to watch for changes via the workspace/didChangeWatchedFiles message.

Case auto-completion

It would be great to insert the branches of a case statement while typing. For example

Example.show(obj: JSON): String
  case obj {

should auto-fill the following:

Example.show(obj: JSON): String
  case obj {
    null:
    bool:
    number:
    string:
    array:
    object:
  }

Make goals interactive

In that case it may be useful to make the numbers that appear when you write a ?hole, clickable... Then this number would be written automatically in the file and compiled again... Do you think it is possible to make something like this?

Handle deletion of source files

Currently this causes things to break. For example:

(node:53366) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/Users/simon/src/github.com/moonad/Kind/base/Fmt/motive2.kind'
(node:53366) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:53366) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
TypeError: Cannot read property 'positionAt' of undefined
    at /Users/simon/src/github.com/simonhorlick/formality-vscode/server/out/fm.js:30:33
    at Array.map (<anonymous>)
    at lspResponseToDiagnostics (/Users/simon/src/github.com/simonhorlick/formality-vscode/server/out/fm.js:27:16)
    at Object.computeDiagnostics (/Users/simon/src/github.com/simonhorlick/formality-vscode/server/out/fm.js:61:29)
    at /Users/simon/src/github.com/simonhorlick/formality-vscode/server/out/server.js:104:23
    at CallbackList.invoke (/Users/simon/src/github.com/simonhorlick/formality-vscode/server/node_modules/vscode-jsonrpc/lib/events.js:62:39)
    at Emitter.fire (/Users/simon/src/github.com/simonhorlick/formality-vscode/server/node_modules/vscode-jsonrpc/lib/events.js:121:36)
    at /Users/simon/src/github.com/simonhorlick/formality-vscode/server/node_modules/vscode-languageserver/lib/main.js:171:38
    at handleNotification (/Users/simon/src/github.com/simonhorlick/formality-vscode/server/node_modules/vscode-jsonrpc/lib/main.js:502:43)
    at processMessageQueue (/Users/simon/src/github.com/simonhorlick/formality-vscode/server/node_modules/vscode-jsonrpc/lib/main.js:273:17)

Checks don't always agree with the kind cli

There shouldn't be any difference, but, for example base/Fmt/sprintf.kind does not check with the cli tool, but does with the extension. Similarly base/Nat/add/cancel_left.kind doesn't check with the extension, but does with the cli tool.

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.