Skip to content

Commit

Permalink
Merge pull request #47 from scott-fleischman/master
Browse files Browse the repository at this point in the history
Add haskell.indentationRules.enabled setting.
  • Loading branch information
JustusAdam authored Oct 2, 2017
2 parents fe24d75 + d91298b commit d01786c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
],
"main": "./out/src/extension",
"contributes": {
"configuration": {
"type": "object",
"title": "Haskell configuration",
"properties": {
"haskell.indentationRules.enabled": {
"type": "boolean",
"default": true,
"description": "Set to 'false' to disable automatically increasing indent on newlines after '=', 'do', 'where' etc."
}
}
},
"languages": [
{
"id": "haskell",
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {


vscode.languages.setLanguageConfiguration('haskell', {

indentationRules: {
// ^.*\{[^}"']*$
increaseIndentPattern: /(\bif\b(?!')(.(?!then))*|\b(then|else|m?do|of|let|in|where)\b(?!')|=|->|>>=|>=>|=<<|(^(data)( |\t)+(\w|')+( |\t)*))( |\t)*$/,
increaseIndentPattern: vscode.workspace.getConfiguration('haskell').indentationRules.enabled
? /(\bif\b(?!')(.(?!then))*|\b(then|else|m?do|of|let|in|where)\b(?!')|=|->|>>=|>=>|=<<|(^(data)( |\t)+(\w|')+( |\t)*))( |\t)*$/
: null,
decreaseIndentPattern: null
},
wordPattern: /([\w'_][\w'_\d]*)|([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)/
Expand Down

0 comments on commit d01786c

Please sign in to comment.