diff --git a/package.json b/package.json index 32de560..8bdfcba 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-tidalcycles", "displayName": "TidalCycles for VSCode", "description": "TidalCycles support in VSCode", - "version": "1.0.1", + "version": "1.0.2", "publisher": "tidalcycles", "icon": "images/icon128.png", "repository": "https://github.com/tidalcycles/vscode-tidalcycles", diff --git a/src/tidal.ts b/src/tidal.ts index 3da9bc3..d61dbf1 100644 --- a/src/tidal.ts +++ b/src/tidal.ts @@ -1,8 +1,7 @@ -import { ILogger } from "./logging"; -import { IGhci } from "./ghci"; +import { ILogger } from './logging'; +import { IGhci } from './ghci'; import * as vscode from 'vscode'; - /** * Provides an interface to send instructions to the current Tidal instance. */ @@ -12,11 +11,16 @@ export interface ITidal { export class Tidal implements ITidal { tidalBooted: boolean = false; - lineEnding = vscode.workspace.getConfiguration('files', null).get('eol', '\n'); + lineEnding = vscode.workspace + .getConfiguration('files', null) + .get('eol', '\n'); - constructor(private logger: ILogger, private ghci: IGhci, - private bootTidalPath: string | null, private useBootFileInCurrentDirectory: boolean) { - } + constructor( + private logger: ILogger, + private ghci: IGhci, + private bootTidalPath: string | null, + private useBootFileInCurrentDirectory: boolean + ) {} private async bootTidal(): Promise { if (this.tidalBooted) { @@ -34,10 +38,14 @@ export class Tidal implements ITidal { const folders = vscode.workspace.workspaceFolders; if (folders !== undefined && folders.length > 0) { - uri = vscode.Uri.parse(`file://${folders[0].uri.path}/BootTidal.hs`); + uri = vscode.Uri.parse( + `file://${folders[0].uri.path}/BootTidal.hs` + ); } else { - this.logger.warning('You must open a folder or workspace in order to use the Tidal \ - useBootFileInCurrentDirectory setting.'); + this.logger.warning( + 'You must open a folder or workspace in order to use the Tidal \ + useBootFileInCurrentDirectory setting.' + ); } } else if (bootTidalPath) { uri = vscode.Uri.file(`${bootTidalPath}`); @@ -61,7 +69,7 @@ export class Tidal implements ITidal { } public async sendTidalExpression(expression: string) { - if (!await this.bootTidal()) { + if (!(await this.bootTidal())) { this.logger.error('Could not boot Tidal'); return; } @@ -74,13 +82,14 @@ export class Tidal implements ITidal { this.ghci.writeLn(':}'); } - private async getBootCommandsFromFile(uri: vscode.Uri): Promise { - + private async getBootCommandsFromFile( + uri: vscode.Uri + ): Promise { this.logger.log(`Using Tidal boot file on disk at ${uri.fsPath}`); let doc: vscode.TextDocument; try { - doc = await vscode.workspace.openTextDocument(uri); + doc = await vscode.workspace.openTextDocument(uri); return doc.getText().split(/[\r\n]+/); } catch (e) { this.logger.error(`Failed to load boot commands from ${uri.fsPath}`); @@ -88,55 +97,58 @@ export class Tidal implements ITidal { } } - bootCommands: string[] = - [ - ':set -XOverloadedStrings', - ':set prompt ""', - ':set prompt-cont ""', - 'import Sound.Tidal.Context', - 'tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20})', - 'let p = streamReplace tidal', - 'let hush = streamHush tidal', - 'let list = streamList tidal', - 'let mute = streamMute tidal', - 'let unmute = streamUnmute tidal', - 'let solo = streamSolo tidal', - 'let unsolo = streamUnsolo tidal', - 'let once = streamOnce tidal False', - 'let asap = streamOnce tidal True', - 'let nudgeAll = streamNudgeAll tidal', - 'let setcps = asap . cps', - 'let xfade i = transition tidal (Sound.Tidal.Transition.xfadeIn 4) i', - 'let xfadeIn i t = transition tidal (Sound.Tidal.Transition.xfadeIn t) i', - 'let histpan i t = transition tidal (Sound.Tidal.Transition.histpan t) i', - 'let wait i t = transition tidal (Sound.Tidal.Transition.wait t) i', - 'let waitT i f t = transition tidal (Sound.Tidal.Transition.waitT f t) i', - 'let jump i = transition tidal (Sound.Tidal.Transition.jump) i', - 'let jumpIn i t = transition tidal (Sound.Tidal.Transition.jumpIn t) i', - 'let jumpIn\' i t = transition tidal (Sound.Tidal.Transition.jumpIn\' t) i', - 'let jumpMod i t = transition tidal (Sound.Tidal.Transition.jumpMod t) i', - 'let mortal i lifespan release = transition tidal (Sound.Tidal.Transition.mortal lifespan release) i', - 'let interpolate i = transition tidal (Sound.Tidal.Transition.interpolate) i', - 'let interpolateIn i t = transition tidal (Sound.Tidal.Transition.interpolateIn t) i', - 'let clutch i = transition tidal (Sound.Tidal.Transition.clutch) i', - 'let clutchIn i t = transition tidal (Sound.Tidal.Transition.clutchIn t) i', - 'let anticipate i = transition tidal (Sound.Tidal.Transition.anticipate) i', - 'let anticipateIn i t = transition tidal (Sound.Tidal.Transition.anticipateIn t) i', - 'let d1 = p 1', - 'let d2 = p 2', - 'let d3 = p 3', - 'let d4 = p 4', - 'let d5 = p 5', - 'let d6 = p 6', - 'let d7 = p 7', - 'let d8 = p 8', - 'let d9 = p 9', - 'let d10 = p 10', - 'let d11 = p 11', - 'let d12 = p 12', - 'let d13 = p 13', - 'let d14 = p 14', - 'let d15 = p 15', - 'let d16 = p 16', - ':set prompt "tidal> "' ]; -} \ No newline at end of file + bootCommands: string[] = [ + ':set -XOverloadedStrings', + ':set prompt ""', + ':set prompt-cont ""', + 'import Sound.Tidal.Context', + 'tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20})', + 'let p = streamReplace tidal', + 'let hush = streamHush tidal', + 'let list = streamList tidal', + 'let mute = streamMute tidal', + 'let unmute = streamUnmute tidal', + 'let solo = streamSolo tidal', + 'let unsolo = streamUnsolo tidal', + 'let once = streamOnce tidal', + 'let asap = once', + 'let nudgeAll = streamNudgeAll tidal', + 'let all = streamAll tidal', + 'let resetCycles = streamResetCycles tidal', + 'let setcps = asap . cps', + 'let xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i', + 'let xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i', + 'let histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i', + 'let wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i', + 'let waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i', + 'let jump i = transition tidal True (Sound.Tidal.Transition.jump) i', + 'let jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i', + "let jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i", + 'let jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i', + 'let mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i', + 'let interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i', + 'let interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i', + 'let clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i', + 'let clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i', + 'let anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i', + 'let anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i', + 'let forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i', + 'let d1 = p 1', + 'let d2 = p 2', + 'let d3 = p 3', + 'let d4 = p 4', + 'let d5 = p 5', + 'let d6 = p 6', + 'let d7 = p 7', + 'let d8 = p 8', + 'let d9 = p 9', + 'let d10 = p 10', + 'let d11 = p 11', + 'let d12 = p 12', + 'let d13 = p 13', + 'let d14 = p 14', + 'let d15 = p 15', + 'let d16 = p 16', + ':set prompt "tidal> "' + ]; +}