Skip to content

Conversation

@glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Sep 23, 2017

This PR adds support for an experimental feature - debugging puppet compilation. This solves #100

Note - This PR builds on #186

@glennsarti glennsarti force-pushed the add-debug-adapter branch 3 times, most recently from aa7a4e4 to 717a79a Compare September 27, 2017 04:52
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge this as experimental, with a doc update in server/README.md and with the commits cleaned up

@glennsarti glennsarti force-pushed the add-debug-adapter branch 3 times, most recently from 3e021c2 to 35c0062 Compare October 31, 2017 22:35
In order to add a Debug Server, parts of the Language Server need to be extacted
into a common namespace so they can be shared between them; Mainly the logging,
TCP Server, and version detection. This commit:

- Moves the TCP Server, logging and version detection from PuppetLanguageServer
  to PuppetVSCode namespace.
- All relevant calls in the language server were modified for the new names
- Updated the spec tests for the new names
@glennsarti glennsarti force-pushed the add-debug-adapter branch 2 times, most recently from 1e1a6ee to 6237ea3 Compare November 1, 2017 00:29
@glennsarti
Copy link
Contributor Author

Nearly done. Need to cleanup one commit.

This commit adds the code necessary to start a Puppet debug session which is
compliant with VS Code's debug adapter protocol.  Instead this is over TCP
instead of STDIN/OUT.

This commit also updates the gulpfile so that this code is added during the
extension packaging process.
In order to support common code between the Extension and an out-of-process
debug adapter, the logging facility was moved to an interface and a series
of concrete implementations.  The Debug Adapter is not able to import the vscode
namespace as it does not exist inside the editor.  This commit;
- Creates a ILogger interface which is passed between objects instead of the
  concrete implementation of Logger
- Changes the current Logger object to be an OutputChannel Logger
- Add a file, null and stdout logging implementation which cna be used by the
  Debug Adapter or during debugging the extenion itself
- Update all of the references to Logger to ILogger in the extension
The Debug Adapter requires similar object and configuration options from the
extension.  This commit refactors out the simple interfaces (i.e. cannot include
complex types, particularly from the vscode namespace) so that it can be
consumed by an out-of-process DebugAdapter.
The Debug Adapter needs to share the ruby detection code with the Extensions
proper however it imported the vscode namespace which is not available out-of-
process.  This commit extracts the ruby environment detection method to a
separate class which can be consumed by the extension or Debug Adapter.
This commit adds a DebugAdapter typescript file, which starts the a puppet
debug server via ruby and then proxies the stdin/stdout commands to the
debug server over TCP.  This commit also configures the debug facility in the
appropriate sections in package.json.

Note that this feature is experimental.
This commit adds documentation about the new experimental feature in the
extension readme.
Previously the Simple TCP server would not exit when a SIGHUP (Ctrl-C) signal
was sent.  This commit changes the stop_services handler so that it is aware
when it is invoked from a TRAP as some operations are not allowed in the TRAP
context.  This commit also updates the trap handlers to use the correct
method name.
@glennsarti glennsarti changed the title {WIP} (GH-100) Add debug adapter (GH-100) Add debug adapter Nov 1, 2017
@glennsarti
Copy link
Contributor Author

@jpogran Ok, I think this is all done. Still missing tests on the debug server, and there are some rubocop violations in the new code.

@jpogran jpogran merged commit 5f932a9 into puppetlabs:master Nov 2, 2017
@glennsarti glennsarti deleted the add-debug-adapter branch January 3, 2018 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants