From 661378df278e0fae3ebe2ee5f011ff6c1dde3c8b Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Tue, 3 Nov 2020 08:36:38 +0100 Subject: [PATCH] Added <- as a recognized assignment operator Most used [assignment operators in R](https://stat.ethz.ch/R-manual/R-devel/library/base/html/assignOps.html) --- src/formatter.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/formatter.ts b/src/formatter.ts index 00e67a5..1302500 100644 --- a/src/formatter.ts +++ b/src/formatter.ts @@ -3,7 +3,7 @@ import * as vscode from "vscode"; enum TokenType { Invalid , Word - , Assignment // = += -= *= /= ?= := <= + , Assignment // = += -= *= /= ?= := <= <- , Arrow // => , Block // {} [] () , PartialBlock // { [ ( @@ -49,7 +49,7 @@ function whitespace( count ) { export default class Formatter { /* Align: - * operators = += -= *= /= ?= : := <= + * operators = += -= *= /= ?= : := <= <- * trailling comment * preceding comma * Ignore anything inside a quote, comment, or block @@ -204,6 +204,8 @@ export default class Formatter { } else if (( char == "+" || char == "-" || char == "*" || char == "/" || char == "?" || char == ":" || char == "<") && next == "=" ) { currTokenType = TokenType.Assignment; nextSeek = 2; + } else if ( char == "<" && next == "-" ) { + currTokenType = TokenType.Assignment; } else if ( char == "=" && next != "=" ) { currTokenType = TokenType.Assignment; } else {