From 5d116594e0e5dbbc7bce34e0ebea039dd1faec7e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 11 May 2016 11:52:40 -0700 Subject: [PATCH] editors.visual-studio-code: try to find "code" then "Code" then... on linux. --- .../visual-studio-code.factor | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/basis/editors/visual-studio-code/visual-studio-code.factor b/basis/editors/visual-studio-code/visual-studio-code.factor index 1cc6488dcf..3b43d7443c 100644 --- a/basis/editors/visual-studio-code/visual-studio-code.factor +++ b/basis/editors/visual-studio-code/visual-studio-code.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2015 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays editors io.files io.pathnames io.standard-paths -kernel make math.parser memoize namespaces sequences system -tools.which ; +USING: combinators.extras combinators.short-circuit editors +generalizations io.files io.pathnames io.standard-paths kernel +make math.parser memoize namespaces sequences system tools.which ; IN: editors.visual-studio-code ! Command line arguments @@ -14,10 +14,11 @@ visual-studio-code editor-class set-global HOOK: find-visual-studio-code-invocation os ( -- array ) MEMO: visual-studio-code-invocation ( -- array ) - \ visual-studio-code-invocation get [ - find-visual-studio-code-invocation - [ { "code" } ] unless* - ] unless* ; + { + [ \ visual-studio-code-invocation get ] + [ find-visual-studio-code-invocation ] + [ "code" ] + } 0|| ; M: macosx find-visual-studio-code-invocation "com.microsoft.VSCode" find-native-bundle [ @@ -29,14 +30,17 @@ M: macosx find-visual-studio-code-invocation ERROR: can't-find-visual-studio-code ; M: linux find-visual-studio-code-invocation - "Code" which [ - home "VSCode-linux-x64/Code" append-path - dup exists? [ drop f ] unless - ] unless* ; + { + [ "code" which ] + [ "Code" which ] + [ home "VSCode-linux-x64/Code" append-path ] + [ "/usr/share/code/code" ] + } [ [ exists? ] ?1arg ] map-compose 0|| ; M: windows find-visual-studio-code-invocation - { "Microsoft VS Code" } "code.exe" find-in-applications - [ f ] unless* ; + { + [ { "Microsoft VS Code" } "code.exe" find-in-applications ] + } 0|| ; M: visual-studio-code editor-command ( file line -- command ) [