D-Scanner icon indicating copy to clipboard operation
D-Scanner copied to clipboard

syntax check from stdin too, like Style check

Open andre2007 opened this issue 8 years ago • 5 comments

Please check attached example. I run D-Scanner with command

dub run dscanner -- -t

D-Scanner starts but never comes back. Same for -s. For argument -S D-Scanner is working dlang-sample.zip

andre2007 avatar Nov 08 '17 20:11 andre2007

When launched without a file name as an input D-Scanner reads from the standard input stream. It's not failing to respond, you just haven't given it any input. The UNIX cat command has the same "bug".

Hackerpilot avatar Nov 08 '17 21:11 Hackerpilot

Why does dub run dscanner -- -S works, while dub run dscanner -- -s does not work? In both cases no filename is provided. 

andre2007 avatar Nov 08 '17 21:11 andre2007

Why does dub run dscanner -- -SWorks, while dub run dscanner -- -sDoes not work? In both cases no filename is provided.

I assume that by "works" you mean "finishes executing immediately" and not "produces useful output". The reason for this difference is that the style check option doesn't yet support reading from stdin.

Hackerpilot avatar Nov 08 '17 22:11 Hackerpilot

Sorry. With works I meant: the style check produces the expected output. See here for a sample https://github.com/linkrope/dunit/issues/14

andre2007 avatar Nov 09 '17 04:11 andre2007

I did some more investigations and I found following behavior: The style check which you can call via

dscanner -S

will find all d source code files within the current work dir and sub directories. Example output:

.\sub\t1.d(3:6)[warn]: Public declaration 'abc' is undocumented.

But the syntax check which you can call via

dscanner -s

does not have this functionality. You have to pass the files as console argument e.g.

dscanner -s app.d sub/t1.d

I wonder why there are different behaviors for -S / -s? You mentioned by not specifying the files while calling dscanner -s, D-Scanner is waiting on stdin for file input. I know from DMD this feature was also implemented but with the "dash" syntax: https://github.com/dlang/dmd/pull/6880

The syntax for D-Scanner would look like

dscanner -s -

Would it be possible to enable the "folder scanning" for -s / -t too by not specifying any files? Enabling the stdin input can be done via the dash syntax.

andre2007 avatar Nov 09 '17 20:11 andre2007