Current file in Run configuration

Answered

Hi guys.

Is it possible to pass to Bash Run configuration path to current IDEA file (file the cursor is inside or file selected in Project toolbar) or catalog (selected in Project toolbar)?
Maybe there is some magical variable $FILEPATH$ that you parse and substitute in Script parameters in Run configuration... (just like in Live templates).

I need this to run source code linter to lint current file I'm working in, not leaving IDEA and not going to external command line.

7 comments
Comment actions Permalink

Hi Alexander,

I do not know if those "magical variables" will work in Run Configuration .. but you can check the list of such supported "variables" in Settings | External Tools (just select any existing or create new one and then check out "Insert macro..." button)

0
Comment actions Permalink

Looks like variables from Settings | External Tools | Insert macro... doesn't work in Run configuration. I've checked $FilePath$ and $FileDir$ - they are left just as is.

Funny thing. I would use External Tool for my linting task, but "Edit tool" dialog seems doesn't support editing of enviroment variables (IDEA doesn't inherit parent envs so I need to customize PATH).
There is no variables substitution in Run configuration and there is no env customizing in External tools :-)

I think I'll add feature requests for these to YouTrack. Before filing a ticket I just wanted to be sure there is no way.
Andriy, thanks for your help.

0
Comment actions Permalink

Well ... you can create custom bash script where you customize your PATH and other environment variables and call all other commands from within.

0
Comment actions Permalink

Hmm, wrapper script with envs just for IDEA. To much noise I suppose :-)

Plus, I have several linting/build scripts and it's really convenient to pick one up out of Run popup list.
External tool requires a distinct shortcut for each tool (I think I wouldn't use mouse for that :) ) and for now even a wrapper environment script.

Anyway, good idea - I can live with that until (and if) implementing my feature request. Nobody knows when it's gonna happen...

0
Comment actions Permalink

Hi, any chance of this getting implemented? 

0
Comment actions Permalink

Feel  free to create feature request on YouTrack: http://youtrack.jetbrains.com/issues/IDEA.

0

Please sign in to leave a comment.