Skip to content

Commit

Permalink
Prettify all documents, set stricter TS and TSLint requirements and f…
Browse files Browse the repository at this point in the history
…ix code
  • Loading branch information
Tehnix committed Apr 8, 2018
1 parent 2317272 commit 4367f6b
Show file tree
Hide file tree
Showing 13 changed files with 3,570 additions and 3,286 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
@@ -0,0 +1,3 @@
printWidth: 120
singleQuote: true
trailingComma: true
23 changes: 13 additions & 10 deletions .vscode/settings.json
@@ -1,13 +1,16 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": true, // set this to true to hide the "out" folder with the compiled JS files
".vscode-test": true,
"node_modules": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"typescript.tsdk": "./node_modules/typescript/lib",
"editor.tabSize": 2 // we want to use the TS server from our node_modules folder to control its version
"files.exclude": {
"out": true, // set this to true to hide the "out" folder with the compiled JS files
".vscode-test": true,
"node_modules": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"typescript.tsdk": "./node_modules/typescript/lib",
"editor.tabSize": 2, // we want to use the TS server from our node_modules folder to control its version,
"[typescript]": {
"editor.formatOnSave": true
}
}
27 changes: 21 additions & 6 deletions Contributing.md
@@ -1,24 +1,27 @@
# Contributing

This document will briefly outline how to get started contributing to the `vscode-hie-server` Haskell language client for the [Haskell-IDE-Engine](https://github.com/haskell/haskell-ide-engine) language server.

## Dependencies and Building

For development, all you need is to,

- run `npm install -g typescript` to get TypeScript,
- then run `npm install` in the project root to install development dependencies.
* run `npm install -g typescript` to get TypeScript,
* then run `npm install` in the project root to install development dependencies.

You can now also package up the extension with,

- `vsce package`
* `vsce package`

which creates an extension package at `vscode-hie-server-<version>.vsix`.

_Note:_ that if you get errors running `vsce package`, it might help running `tsc -p ./` directly, since that gives the actual error output of the TypeScript compilation.

## Developing

* Launch VS Code, press `File` > `Open Folder`, open the `vscode-hie-server` folder;
* press `F5` to open a new window with the `vscode-hie-server` loaded (this will overwrite existing ones, e.g. from the marketplace);
* open a Haskell file with the __new__ editor to test the LSP client;
* open a Haskell file with the **new** editor to test the LSP client;

You are now ready to make changes and debug. You can,

Expand All @@ -29,8 +32,18 @@ You are now ready to make changes and debug. You can,

_Note_: you can also reload (`Ctrl+R` or `Cmd+R` on macOS) the VS Code window with your extension to load your changes

#### Formatting

To keep a consistent style, it's best to run [prettier](https://prettier.io) on each save. If you are using VSCode, the settings are set to auto format on save.

There is usually an extension for your editor for prettier, e.g. [`esbenp.prettier-vscode`](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), which you can install through the marketplace or via `ext install prettier-vscode`.

The configurations for prettier are located in `.prettierrc`.

## Navigating the Files

A brief overview of the files,

* `package.json` contains the basic information about the package, see [the full manifest for more](https://code.visualstudio.com/docs/extensionAPI/extension-manifest), such as telling VS Code which scope the LSP works on (Haskell and Literate Haskell in our case), and possible configuration
* `src/extension.ts` handles activating and deactivating the HIE language server, along with checking if HIE is installed
* `src/docsBrowser.ts` contains the logic for displaying the documentation browser (e.g. hover over a type like `mapM_` and click `Documentation` or `Source`)
Expand All @@ -39,12 +52,14 @@ A brief overview of the files,
* `src/commands/insertType.ts` handles inserting a type using the output of `ghcmod:type`

## Helpful Reading Material

We recommend checking out [Your First VS Code Extension](https://code.visualstudio.com/docs/extensions/example-hello-world) and [Creating a Language Server](https://code.visualstudio.com/docs/extensions/example-language-server) for some introduction to VS Code extensions.

## Running tests

* open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`
* press `F5` to run the tests in a new window with your extension loaded
* see the output of the test result in the debug console
* make changes to `test/extension.test.ts` or create new test files inside the `test` folder
* by convention, the test runner will only consider files matching the name pattern `**.test.ts`
* you can create folders inside the `test` folder to structure your tests any way you want
* by convention, the test runner will only consider files matching the name pattern `**.test.ts`
* you can create folders inside the `test` folder to structure your tests any way you want

0 comments on commit 4367f6b

Please sign in to comment.