Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent cmd.exe popup on Windows #68

Merged
merged 3 commits into from
Feb 17, 2022
Merged

Conversation

C0Nd3Mnd
Copy link
Contributor

@C0Nd3Mnd C0Nd3Mnd commented Feb 9, 2022

On Windows, a cmd.exe window pops up for a brief moment when the plugin initializes. This PR changes it so the window is hidden.

@predragnikolic
Copy link
Member

predragnikolic commented Feb 14, 2022

Hello,

I do not use Windows, so I cannot test this there,
but this PR doesn't work on Linux, as it throws this error:

Traceback (most recent call last):
  File "/home/predragnikolic/.config/sublime-text/Packages/LSP/plugin/core/windows.py", line 249, in start_async
    cannot_start_reason = plugin_class.can_start(self._window, initiating_view, workspace_folders, config)
  File "/home/predragnikolic/.config/sublime-text/Packages/lsp_utils/st3/lsp_utils/npm_client_handler.py", line 110, in can_start
    reason = super().can_start(window, initiating_view, workspace_folders, configuration)
  File "/home/predragnikolic/.config/sublime-text/Packages/lsp_utils/st3/lsp_utils/_client_handler/abstract_plugin.py", line 120, in can_start
    message = cls.is_allowed_to_start(window, initiating_view, workspace_folders, configuration)
  File "/home/predragnikolic/.config/sublime-text/Packages/LSP-volar/plugin.py", line 39, in is_allowed_to_start
    startupinfo = subprocess.STARTUPINFO()
AttributeError: 'module' object has no attribute 'STARTUPINFO'

The reason being:

https://docs.python.org/3/library/subprocess.html#windows-popen-helpers
The STARTUPINFO class and following constants are only available on Windows.

@C0Nd3Mnd
Copy link
Contributor Author

Thanks for the heads-up. I'll update this PR in the coming days and I'll make sure to test it under Windows and on Linux this time. I don't have a Mac right now so I'm afraid I can't test on macOS for the time being.

@C0Nd3Mnd
Copy link
Contributor Author

I fixed the issue. Tested it successfully with Windows 10 21H2 and Fedora 35.

@predragnikolic
Copy link
Member

Thanks :)

Tested on Linux ✔️ works
I assume that it also works on Mac Os as well,
but I will test it on a Mac till the end of the week just to be sure.
Than I will proceed with merging this.

plugin.py Outdated Show resolved Hide resolved
@predragnikolic predragnikolic merged commit 46b1b2d into sublimelsp:master Feb 17, 2022
@predragnikolic
Copy link
Member

Thanks again for the PR. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants