editors.visual-studio-code: try to find "code" then "Code" then... on linux.
parent
8330256b1d
commit
5d116594e0
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2015 Doug Coleman.
|
! Copyright (C) 2015 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays editors io.files io.pathnames io.standard-paths
|
USING: combinators.extras combinators.short-circuit editors
|
||||||
kernel make math.parser memoize namespaces sequences system
|
generalizations io.files io.pathnames io.standard-paths kernel
|
||||||
tools.which ;
|
make math.parser memoize namespaces sequences system tools.which ;
|
||||||
IN: editors.visual-studio-code
|
IN: editors.visual-studio-code
|
||||||
|
|
||||||
! Command line arguments
|
! Command line arguments
|
||||||
|
@ -14,10 +14,11 @@ visual-studio-code editor-class set-global
|
||||||
HOOK: find-visual-studio-code-invocation os ( -- array )
|
HOOK: find-visual-studio-code-invocation os ( -- array )
|
||||||
|
|
||||||
MEMO: visual-studio-code-invocation ( -- array )
|
MEMO: visual-studio-code-invocation ( -- array )
|
||||||
\ visual-studio-code-invocation get [
|
{
|
||||||
find-visual-studio-code-invocation
|
[ \ visual-studio-code-invocation get ]
|
||||||
[ { "code" } ] unless*
|
[ find-visual-studio-code-invocation ]
|
||||||
] unless* ;
|
[ "code" ]
|
||||||
|
} 0|| ;
|
||||||
|
|
||||||
M: macosx find-visual-studio-code-invocation
|
M: macosx find-visual-studio-code-invocation
|
||||||
"com.microsoft.VSCode" find-native-bundle [
|
"com.microsoft.VSCode" find-native-bundle [
|
||||||
|
@ -29,14 +30,17 @@ M: macosx find-visual-studio-code-invocation
|
||||||
ERROR: can't-find-visual-studio-code ;
|
ERROR: can't-find-visual-studio-code ;
|
||||||
|
|
||||||
M: linux find-visual-studio-code-invocation
|
M: linux find-visual-studio-code-invocation
|
||||||
"Code" which [
|
{
|
||||||
home "VSCode-linux-x64/Code" append-path
|
[ "code" which ]
|
||||||
dup exists? [ drop f ] unless
|
[ "Code" which ]
|
||||||
] unless* ;
|
[ home "VSCode-linux-x64/Code" append-path ]
|
||||||
|
[ "/usr/share/code/code" ]
|
||||||
|
} [ [ exists? ] ?1arg ] map-compose 0|| ;
|
||||||
|
|
||||||
M: windows find-visual-studio-code-invocation
|
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 )
|
M: visual-studio-code editor-command ( file line -- command )
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue