mattn / efm-langserver

General purpose Language Server
MIT License
1.32k stars 59 forks source link

[Question] How to inject combination of variables in flag? #251

Closed OopsYao closed 11 months ago

OopsYao commented 12 months ago

The doc describes how to use variable injection like ${--flag:key}, but how do I inject something like --lines 5-9 containing 2-more variables as a combination, where 5 is rowStart while 9 is rowEnd?

milanglacier commented 11 months ago

You can write your own shell script wrapper that can accept row start and row end and then pass it to the command you want to call

OopsYao commented 11 months ago

You can write your own shell script wrapper that can accept row start and row end and then pass it to the command you want to call

Oh yes, didn't realize it. And I guess we can use something like xargs if we don't want a standalone wrapper.

Here is an example of latexindent with range formatting if any one is interested:

latexindent $(echo ${--useless:rowStart} ${--useless:rowEnd} | xargs -n4 -r sh -c 'echo --lines $(($1+1))-$(($3+1))')