linux-china / jetbrains-just-plugin

JetBrains Just Command Runner Plugin
https://plugins.jetbrains.com/plugin/18658-just
Apache License 2.0
35 stars 6 forks source link

line breaks marked as error #18

Closed wryfi closed 4 months ago

wryfi commented 7 months ago

The following justfile is valid and works fine for me, but it gets flagged with an error in the IDE:

VERSION := `git describe --tags --dirty 2> /dev/null || echo v0`
REVISION := `git rev-parse --short HEAD 2> /dev/null || echo 0`
BUILD_DATE := `date +'%FT%T%z'`

LDFLAGS := '-ldflags "-X gitlab.com/foo/random/global.Version=' + VERSION \
            + ' -X gitlab.com/foo/random/global.Revision=' + REVISION \
            + ' -X gitlab.com/foo/random/global.BuildDate=' + BUILD_DATE + ' -w -s"'

default:
    @just --list --justfile {{ justfile() }}

build:
    @echo {{ LDFLAGS }}
    GOARCH=arm64 GOOS=darwin go build -o build/random_{{ VERSION }}_darwin_arm64 {{ LDFLAGS }} main.go

image

nyurik commented 6 months ago

I actually filed a https://github.com/casey/just/issues/1761 because of this issue, even though turns out just supports it just fine :(

fabiomoratti commented 4 months ago

Please note that a backslash ("\") escaped newline is marked as an error also for recipe dependencies, see for example the following that get processed correctly by just:

task_1:
    echo "This is task_1"

task_1:
    echo "This is task_1"

task_1:
    echo "This is task_1"

all_tasks: task_1 \
    task_2 \
    task_3

The error reported is:

JustToken.ATTRIBUTE, JustToken.COMMENT, JustToken.KEYWORD_ALIAS, JustToken.KEYWORD_EXPORT, JustToken.KEYWORD_MOD, JustToken.KEYWORD_SET, JustToken.NEW_LINE, JustToken.RECIPE_NAME, JustToken.SHEBANG or JustToken.VARIABLE expected, got '\'

Other than this very handy plugin, makes working with just files very simple.

linux-china commented 4 months ago

@fabiomoratti now it's some hard to implement this feature of escaped newline for task names, and I need to rewrite the Lexer, sorry for that. Now you should use all_tasks: task_1 task_2 task_3 with one line style.

linux-china commented 4 months ago

fixed by https://github.com/linux-china/jetbrains-just-plugin/pull/25

image

linux-china commented 4 months ago

Fixed in 0.4.3