blindly / vscode-puppet

Puppet Language and Snippets Support for Visual Studio Code
MIT License
9 stars 5 forks source link

VSCode thinks extension constantly needs a window reload #11

Open michael-gracy opened 7 years ago

michael-gracy commented 7 years ago

After installing the extension, it stays in 'Reload' state continually. I've uninstalled and reinstalled several times, completely restarting VSC in between. I opened the debug panel and only see warnings from the jinja2 extension. I disabled the jinja2 extension to see if it was overwriting or hiding something, I just get a clean startup as far as the log shows, but the vscode-puppet still shows 'Reload' in the extension manager.

VSC: 1.81 OSX vscode-puppet: 0.3.1

kenmaglio commented 7 years ago

I am having the same problem, and our team relies on the Puppet-Lint functionality which now is not working because of this issue. Please help!

splummer commented 7 years ago

Same problem here.

KZachariassen commented 7 years ago

Same here - could we get some attention to this bug? :)

Im on VSC 1.8.1 Windows 10

kenmaglio commented 7 years ago

Still broke after update today

kenmaglio commented 7 years ago

Feedback left on main VSCode project page of 1 star until resolved as it is broke and will not load / work.

kenmaglio commented 7 years ago

.....

dschaaff commented 7 years ago

Broke here too. I need to learn how to write these extensions so I could pull request

kenmaglio commented 7 years ago

I need to learn how to write these extensions so I could pull request

You and me both, I might try to figure out how to do this. And create a stand-alone puppet-lint again.

I tried - for what it's worth - to go grab old versions of both of these, and simply drop them in the extension folders, but nothing was working. I'm thinking something with Puppet-Lint is the issue actually and not this extension - but I don't even know by looking at the source, what it's trying to execute to replicate it on the command line.

jeff-cook commented 7 years ago

Any ideas on how to research the cause? I can't seem to find any log file or errors. I just says it needs a reload.

Thanks

tleepa commented 7 years ago

The problem cause is explained in this comment - I assume the problem is related to Windows OS. In this case one need to modify the {your code settings folder}\extensions\Borke.Puppet-0.3.2\out\src\features\puppetLintProvider.js and change line 13 to include the full path to puppet-lint.bat, e.g. c:\\program files\\ruby\\bin\\puppet-lint.bat. It makes linting working again, but doesn't help with the 'Reload' state. Strangely, the latter disappears when running Insider version 1.10.

tleepa commented 7 years ago

I got a hold of the old puppet-lint extension. I remember this was working fine on Windows. The reason for this was because it was differentiating between Windows OS and other and, in case of the former, it was spawning cmd.exe /c puppet-lint. This caused to run puppet-lint.bat rather than puppet-lint, hence no problems there.

So, if you want to make this extension working in both Windows and Linux, the puppetLintProvider.js needs to be amended and instead of this line:

let childProcess = cp.spawn('puppet-lint', ["--log-format", "%{KIND}:%{line}:%{message}", textDocument.fileName], options);

one needs to put something like this:

let command = '';
let commandOptions = '';
if (process.platform == "win32") {
    command = "cmd.exe";
    commandOptions = ["/c", "puppet-lint", "--log-format", "%{KIND}:%{line}:%{message}", textDocument.fileName];
}
else {
    command = "puppet-lint";
    commandOptions = ["--log-format", "%{KIND}:%{line}:%{message}", textDocument.fileName];
}
let childProcess = cp.spawn(command, commandOptions, options);

PFA the puppetLintProvider from the original extension. The attached is version 0.1.3 that - according to readme - enabled Windows support. This version seems not to be available on jgreat GitHub, though.

dschaaff commented 7 years ago

If I clone the repo and run the extension in debug mode it loads and works correctly. I then manually packaged it and installed it locally. When run that way the reload issue goes away. Based on this I wonder if the extension just needs to be republished.

To do this yourself