Skip to content

Commit

Permalink
fix(codespace): issues with codespace build
Browse files Browse the repository at this point in the history
- fix: don't install docker-from-docker feature, it fails
- fix: syntax highlighting
- fix: readme updates for codespace guide

Fixes and closes #911

Signed-off-by: Sam Gammon <sam@elide.ventures>
  • Loading branch information
sgammon committed May 16, 2024
1 parent e444292 commit 5cd3312
Show file tree
Hide file tree
Showing 16 changed files with 485 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ RUN apt-get update \
&& elide --help \
&& elide selftest \
&& elide info \
&& mkdir -p $HOME/.elide \
&& echo "Elide codespace container image ready."

ENTRYPOINT ["/usr/local/share/docker-init.sh"]
COPY ./elide-home/* /home/vscode/.elide/
RUN chown -R $(whoami) $HOME/.elide

CMD ["sleep", "infinity"]
36 changes: 34 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ elide selftest
**To run a JavaScript terminal:**

```
elide shell
elide
```
Or:
```
elide repl
```

**Encode some JSON:**
Expand Down Expand Up @@ -69,11 +73,39 @@ elide serve tools/scripts/server.js
**To run a Python terminal:**

```
elide shell --python
elide repl --python
```

**To see `.env` environment:**

```python
import os; print(os.environ)
```

**To see all environment, including host env:**

```
elide repl --python --host:allow-env
```

```python
import os; print(os.environ)
```

### Ruby

**To run a Ruby terminal:**

```
elide repl --ruby
```

**Say hello:**

```ruby
puts "Hello, Elide!"
```

## Further Reading

Check out Elide's [docs](https://docs.elide.dev) for more exercises.
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"postAttachCommand": "echo 'ELIDE_CODESPACE=true' > .env && touch package.json && code .devcontainer/README.md && clear && elide --help",
"overrideCommand": false,
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/docker-from-docker:1": {}
"ghcr.io/devcontainers/features/git:1": {}
},
"customizations": {
"codespaces": {
Expand Down
2 changes: 2 additions & 0 deletions .devcontainer/elide-home/jnanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
theme /Users/sam/.elide/nanorc/dark.nanorctheme
include /Users/sam/.elide/nanorc/*.nanorc
13 changes: 13 additions & 0 deletions .devcontainer/elide-home/nanorc/args.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax "ARGS"

NUMBER: "\<[-]?[0-9]*([Ee][+-]?[0-9]+)?\>" "\<[-]?[0](\.[0-9]+)?\>"
STRING: "[a-zA-Z]+[a-zA-Z0-9]*"
COMMAND: "\<(console|grab|inspect|classloader)\>"
NULL: "\<null\>"
BOOLEAN: "\<(true|false)\>"
VARIABLE: "(\[|,)\s*[a-zA-Z0-9]*\s*:"
OPTION: "(^|\s+)[-]{1,2}[a-zA-Z0-9\?]+(\s+|$|=)"
PLAIN: "(:|\[|,|\]|=)"
$BLOCK_COMMENT: "/*, */"
$LINE_COMMENT: "//"
$BALANCED_DELIMITERS "", '"
7 changes: 7 additions & 0 deletions .devcontainer/elide-home/nanorc/command.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
syntax "COMMAND"

COMMAND: "[a-zA-Z]+[a-zA-Z0-9]*"
VARIABLE: ".*="
PLAIN: "(\"|'|\.|=|:|\[|,|\])"
COMMENT: "(^|\\s+)#.*$"
$BLOCK_COMMENT: "/*, */"
73 changes: 73 additions & 0 deletions .devcontainer/elide-home/nanorc/dark.nanorctheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#
# This file describes a default scheme for nanorc syntax highlighting for terminals with dark background
#
# Lines that start with a # character are comments.
# Comments are ignored. Empty lines are ignored too. Leading/trailing white
# space characters are removed before theme file is processed.
#
# Each line of the theme file describes a token type and how this token type
# should be colored (highlighted). The first word on each line is the name
# of the token type. After the name of the token type at least one white space
# character must follow, and then a text and background color
# for the highlighting must be specified, separated by a comma. No spaces
# are allowed inside color definition (that is, color definition is considered
# a single word, despite a possible comma).
#
# Background color can be omitted (in which case default background color
# of the terminal will be used). If you are omitting the background color,
# a comma may be omitted also. Likewise, a text color can be omitted,
# but comma must be present in this case.
#
# Author: Yuri Sakhno
# ysakhno at gmail dot com
#
# https://github.com/YSakhno/nanorc/
#

PLAIN white
FUNCTION brightgreen
STRING brightcyan
COMMENT cyan
DOC_COMMENT brightcyan
TYPE brightblue
BOOLEAN brightwhite
NULL cyan
NUMBER blue
VARIABLE brightyellow
PACKAGE green,faint
CLASS green
CONSTANT yellow
OPERATOR yellow
COMMAND brightgreen
OPTION yellow
KEYWORD brightwhite
JUMP brightcyan
SECTION brightgreen
ATTRIBUTE green
PATH brightblue
EXECUTABLE green
LINK cyan
TITLE brightblue
ESCAPE black,cyan
DEBUG brightmagenta
ERROR red
TODO brightwhite,cyan
WARNING ,red
WHITESPACE ,green
HEADER bold,!blue,~grey7,underline
ROW_NUMBER bold,!blue,~grey7
ROW_STYLE ,~grey15
LIST_BACKGROUND ,~grey42
LIST_GROUP yellow
#
# mixin
#
+FUNCTION FUNCTION: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" \n PLAIN: "[(]"
+LINT WHITESPACE: "[[:space:]]+$" \n WARNING: "\t*"
+LONG_LINE_WARNING WARNING: "^.{81,}$"
#
# parser
#
$LINE_COMMENT COMMENT \n TODO: "FIXME|TODO|XXX"
$BLOCK_COMMENT COMMENT \n DOC_COMMENT: startWith=/** \n TODO: "FIXME|TODO|XXX"
$BALANCED_DELIMITERS STRING \n VARIABLE: continueAs=\s*:
24 changes: 24 additions & 0 deletions .devcontainer/elide-home/nanorc/java.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax "Java" "\.java$"

# Class
SECTION: "class +[A-Za-z0-9]+ *((implements|extends) +[A-Za-z0-9.]+)?"

# Annotation
ESCAPE: "@[A-Za-z]+"

# +FUNCTION
TYPE: "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
KEYWORD: "\<(case|catch|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
PACKAGE: "(([a-z]{2,}[.]{1}){2,10}([a-z]{2,}){0,1})"
CLASS: "\<[A-Z]{0,2}([A-Z]{1}[a-z]+){1,}\>"
KEYWORD: "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
JUMP: "\<(break|continue)\>"
NULL: "\<(null)\>"
BOOLEAN: "\<(true|false)\>"
CONSTANT: "\<[A-Z]+([_]{1}[A-Z]+){0,}\>"
OPERATOR: "[-+/*=<>?:!~%&|]"
~NUMBER: "\b(([1-9][0-9]+)|0+)\.[0-9]+\b" "\b[1-9][0-9]*\b" "\b0[0-7]*\b" "\b0x[1-9a-f][0-9a-f]*\b"
$BALANCED_DELIMITERS: """
$LINE_COMMENT: "//"
$BLOCK_COMMENT: "/*, */"
+LINT
42 changes: 42 additions & 0 deletions .devcontainer/elide-home/nanorc/javascript.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
syntax "JavaScript" "\.js$"
SECTION: "class +[A-Za-z0-9]+ *((implements|extends) +[A-Za-z0-9.]+)?"
ESCAPE: "@[A-Za-z]+"
TYPE: "\<(Array|Boolean|Date|Enumerator|Error|Function|Math)\>"
TYPE: "\<(Map|WeakMap|Set|WeakSet|Promise|Symbol|Number|Object|RegExp|String|JSON)\>"
TYPE: "\<(Number|Object|RegExp|String)\>"
KEYWORD: "\<(const|let|class|extends|get|set|of|async|await|yield)\>"
KEYWORD: "\<(import|as|from|export)\>"
NULL: "\<(null|undefined)\>"
JUMP: "\<(break|case|catch|continue|default|delete|do|else|finally)\>"
CLASS: "\<[A-Z]{0,2}([A-Z]{1}[a-z]+){1,}\>"
BOOLEAN: "\<(true|false)\>"
CONSTANT: "\<[A-Z]+([_]{1}[A-Z]+){0,}\>"
OPERATOR: "[-+/*=<>?:!~%&|]"
~NUMBER: "\b(([1-9][0-9]+)|0+)\.[0-9]+\b" "\b[1-9][0-9]*\b" "\b0[0-7]*\b" "\b0x[1-9a-f][0-9a-f]*\b"
$BALANCED_DELIMITERS: """
$LINE_COMMENT: "//"
$BLOCK_COMMENT: "/*, */"
+LINT
color brightblue "\<[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\>"
color brightblue "\<[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
color brightblue "\<[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
color cyan "\<(break|case|catch|continue|default|delete|do|else|finally)\>"
color cyan "\<(for|function|get|if|in|instanceof|new|return|set|switch)\>"
color cyan "\<(switch|this|throw|try|typeof|var|void|while|with)\>"
color cyan "\<(null|undefined|NaN)\>"
color cyan "\<(import|as|from|export)\>"
color cyan "\<(const|let|class|extends|get|set|of|async|await|yield)\>"
color brightcyan "\<(true|false)\>"
color green "\<(Array|Boolean|Date|Enumerator|Error|Function|Math)\>"
color green "\<(Map|WeakMap|Set|WeakSet|Promise|Symbol)\>"
color green "\<(Number|Object|RegExp|String)\>"
color red "[-+/*=<>!~%?:&|]"
color magenta "/[^*]([^/]|(\\/))*[^\\]/[gim]*"
color magenta "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
color brightblack start="/\*" end="\*/"
color brightblack start="/\*\*" end="\*/"
color brightblack "//.*"
color brightblack "/\*.+\*/"
color brightwhite,cyan "TODO:?"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'|(`|\})(\\.|[^`$]|$[^{])*(\$\{|`)"
color ,red " + +| + +"
8 changes: 8 additions & 0 deletions .devcontainer/elide-home/nanorc/json.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
syntax "JSON" "\.json$"
header "^\{$"

NUMBER: "\<[-]?[0-9]*([Ee][+-]?[0-9]+)?\>" "\<[-]?[0](\.[0-9]+)?\>"
NULL: "\<null\>"
BOOLEAN: "\<(true|false)\>"
ESCAPE: "\\u[0-9a-fA-F]{4}|\\[bfnrt'"/\\]"
$BALANCED_DELIMITERS "", '"
26 changes: 26 additions & 0 deletions .devcontainer/elide-home/nanorc/kotlin.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Nano syntax file
# Language: Kotlin
# Maintainer: Bjarne Holen <bjarneholen@gmail.com>
# Edited by: Ritiek Malhotra <ritiekmalhotra123@gmail.com>
# Last Change: 2017 May 24
# Copyright (c) 2014, Bjarne Holen

syntax "Kotlin" "\.kt$" "\.kts$"
color magenta "\b(([1-9][0-9]+)|0+)\.[0-9]+\b" "\b[1-9][0-9]*\b" "\b0[0-7]*\b" "\b0x[1-9a-f][0-9a-f]*\b"
color yellow "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
color green "\<(namespace|as|type|class|this|super|val|var|fun|is|in|object|when|trait|import|where|by|get|set|abstract|enum|open|annotation|override|private|public|internal|protected|out|vararg|inline|final|package|lateinit|constructor|companion|const|suspend|sealed)\>"
color yellow "\<(true|false|null)\>"
color cyan "\<(break|catch|continue|do|else|finally|for|if|return|throw|try|while|repeat)\>"
color brightred "\<(inner|outer)\>"
##
## String highlighting. You will in general want your comments and
## strings to come last, because syntax highlighting rules will be
## applied in the order they are read in.
color brightblue "<[^= ]*>" ""(\\.|[^"])*""

## Comment highlighting
color red "^\s*//.*"
color red start="^\s*/\*" end="\*/"

## Trailing whitespace
color ,green "[[:space:]]+$"
51 changes: 51 additions & 0 deletions .devcontainer/elide-home/nanorc/light.nanorctheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# This file describes a default scheme for nanorc syntax highlighting for terminals with light background.
#

PLAIN black
FUNCTION green
STRING cyan
COMMENT brightcyan
DOC_COMMENT cyan
TYPE brightblue
BOOLEAN brightblack
NULL cyan
NUMBER blue
VARIABLE brightyellow
PACKAGE green,faint
CLASS green
CONSTANT yellow
OPERATOR yellow
COMMAND green
OPTION yellow
KEYWORD brightblack
JUMP cyan
SECTION green
ATTRIBUTE green
PATH brightblue
EXECUTABLE green
LINK cyan
TITLE brightblue
ESCAPE black,cyan
DEBUG brightmagenta
ERROR red
TODO brightwhite,cyan
WARNING ,lightred
WHITESPACE ,lightgreen
HEADER bold,!blue,~grey70,underline
ROW_NUMBER bold,!blue,~grey70
ROW_STYLE ,~grey82
LIST_BACKGROUND ,~grey70
LIST_GROUP yellow
#
# mixin
#
+FUNCTION FUNCTION: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" \n PLAIN: "[(]"
+LINT WHITESPACE: "[[:space:]]+$" \n WARNING: "\t*"
+LONG_LINE_WARNING WARNING: "^.{81,}$"
#
# parser
#
$LINE_COMMENT COMMENT \n TODO: "FIXME|TODO|XXX"
$BLOCK_COMMENT COMMENT \n DOC_COMMENT: startWith=/** \n TODO: "FIXME|TODO|XXX"
$BALANCED_DELIMITERS STRING \n VARIABLE: continueAs=\s*:
60 changes: 60 additions & 0 deletions .devcontainer/elide-home/nanorc/nanorctheme.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#
# This file describes a default scheme template for nanorc syntax highlighting for terminals with dark background
#
# Actual nanorc themes can be generated using the themes available on https://mayccoll.github.io/Gogh/themes.
#
# Linux:
# \> cd git/jline3
# \> ./build rebuild
# \> cd git/jline3/demo/target/nanorc
# \> bash -c "$(wget -qO- https://git.io/vQgMr)"
# ...
#

PLAIN %COLOR_08
FUNCTION %COLOR_11
STRING %COLOR_15
COMMENT %COLOR_07
DOC_COMMENT %COLOR_15
TYPE %COLOR_13
BOOLEAN %COLOR_16
NULL %COLOR_07
NUMBER %COLOR_05
VARIABLE %COLOR_12
PACKAGE %COLOR_03
CLASS %COLOR_03
CONSTANT %COLOR_04
OPERATOR %COLOR_04
COMMAND %COLOR_11
OPTION %COLOR_04
KEYWORD %COLOR_16
JUMP %COLOR_15
SECTION %COLOR_11
ATTRIBUTE %COLOR_03
PATH %COLOR_13
EXECUTABLE %COLOR_03
LINK %COLOR_07
TITLE %COLOR_13
ESCAPE %COLOR_01,%COLOR_07
DEBUG %COLOR_14
ERROR %COLOR_02
TODO %COLOR_16,%COLOR_07
WARNING ,%COLOR_02
WHITESPACE ,%COLOR_03
HEADER bold,%COLOR_13,~grey7,underline
ROW_NUMBER bold,%COLOR_13,~grey7
ROW_STYLE ,~grey15
LIST_BACKGROUND ,~grey42
LIST_GROUP %COLOR_04
#
# mixin
#
+FUNCTION FUNCTION: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" \n PLAIN: "[(]"
+LINT WHITESPACE: "[[:space:]]+$" \n WARNING: "\t*"
+LONG_LINE_WARNING WARNING: "^.{81,}$"
#
# parser
#
$LINE_COMMENT COMMENT \n TODO: "FIXME|TODO|XXX"
$BLOCK_COMMENT COMMENT \n DOC_COMMENT: startWith=/** \n TODO: "FIXME|TODO|XXX"
$BALANCED_DELIMITERS STRING \n VARIABLE: continueAs=\s*:
Loading

0 comments on commit 5cd3312

Please sign in to comment.