puppet-editor-services 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +510 -0
  3. data/CODEOWNERS +2 -0
  4. data/CODE_OF_CONDUCT.md +46 -0
  5. data/CONTRIBUTING.md +54 -0
  6. data/Gemfile +53 -0
  7. data/LICENSE +201 -0
  8. data/README.md +308 -0
  9. data/Rakefile +185 -0
  10. data/bin/puppet-debugserver +8 -0
  11. data/bin/puppet-languageserver +7 -0
  12. data/bin/puppet-languageserver-sidecar +7 -0
  13. data/lib/dsp/dsp.rb +7 -0
  14. data/lib/dsp/dsp_base.rb +62 -0
  15. data/lib/dsp/dsp_protocol.rb +4619 -0
  16. data/lib/lsp/lsp.rb +10 -0
  17. data/lib/lsp/lsp_base.rb +63 -0
  18. data/lib/lsp/lsp_custom.rb +170 -0
  19. data/lib/lsp/lsp_enums.rb +143 -0
  20. data/lib/lsp/lsp_protocol.rb +2785 -0
  21. data/lib/lsp/lsp_protocol_callhierarchy.proposed.rb +239 -0
  22. data/lib/lsp/lsp_protocol_colorprovider.rb +100 -0
  23. data/lib/lsp/lsp_protocol_configuration.rb +82 -0
  24. data/lib/lsp/lsp_protocol_declaration.rb +73 -0
  25. data/lib/lsp/lsp_protocol_foldingrange.rb +129 -0
  26. data/lib/lsp/lsp_protocol_implementation.rb +75 -0
  27. data/lib/lsp/lsp_protocol_progress.rb +200 -0
  28. data/lib/lsp/lsp_protocol_selectionrange.rb +79 -0
  29. data/lib/lsp/lsp_protocol_sematictokens.proposed.rb +340 -0
  30. data/lib/lsp/lsp_protocol_typedefinition.rb +75 -0
  31. data/lib/lsp/lsp_protocol_workspacefolders.rb +174 -0
  32. data/lib/lsp/lsp_types.rb +1534 -0
  33. data/lib/puppet-debugserver/debug_session/break_points.rb +137 -0
  34. data/lib/puppet-debugserver/debug_session/flow_control.rb +161 -0
  35. data/lib/puppet-debugserver/debug_session/hook_handlers.rb +295 -0
  36. data/lib/puppet-debugserver/debug_session/puppet_session_run_mode.rb +66 -0
  37. data/lib/puppet-debugserver/debug_session/puppet_session_state.rb +122 -0
  38. data/lib/puppet-debugserver/hooks.rb +132 -0
  39. data/lib/puppet-debugserver/message_handler.rb +277 -0
  40. data/lib/puppet-debugserver/puppet_debug_session.rb +541 -0
  41. data/lib/puppet-debugserver/puppet_monkey_patches.rb +118 -0
  42. data/lib/puppet-languageserver/client_session_state.rb +119 -0
  43. data/lib/puppet-languageserver/crash_dump.rb +50 -0
  44. data/lib/puppet-languageserver/epp/validation_provider.rb +34 -0
  45. data/lib/puppet-languageserver/facter_helper.rb +25 -0
  46. data/lib/puppet-languageserver/global_queues/sidecar_queue.rb +205 -0
  47. data/lib/puppet-languageserver/global_queues/single_instance_queue.rb +126 -0
  48. data/lib/puppet-languageserver/global_queues/validation_queue.rb +102 -0
  49. data/lib/puppet-languageserver/global_queues.rb +16 -0
  50. data/lib/puppet-languageserver/manifest/completion_provider.rb +331 -0
  51. data/lib/puppet-languageserver/manifest/definition_provider.rb +99 -0
  52. data/lib/puppet-languageserver/manifest/document_symbol_provider.rb +228 -0
  53. data/lib/puppet-languageserver/manifest/folding_provider.rb +226 -0
  54. data/lib/puppet-languageserver/manifest/format_on_type_provider.rb +143 -0
  55. data/lib/puppet-languageserver/manifest/hover_provider.rb +221 -0
  56. data/lib/puppet-languageserver/manifest/signature_provider.rb +169 -0
  57. data/lib/puppet-languageserver/manifest/validation_provider.rb +127 -0
  58. data/lib/puppet-languageserver/message_handler.rb +462 -0
  59. data/lib/puppet-languageserver/providers.rb +18 -0
  60. data/lib/puppet-languageserver/puppet_helper.rb +108 -0
  61. data/lib/puppet-languageserver/puppet_lexer_helper.rb +55 -0
  62. data/lib/puppet-languageserver/puppet_monkey_patches.rb +39 -0
  63. data/lib/puppet-languageserver/puppet_parser_helper.rb +212 -0
  64. data/lib/puppet-languageserver/puppetfile/validation_provider.rb +185 -0
  65. data/lib/puppet-languageserver/server_capabilities.rb +48 -0
  66. data/lib/puppet-languageserver/session_state/document_store.rb +272 -0
  67. data/lib/puppet-languageserver/session_state/language_client.rb +239 -0
  68. data/lib/puppet-languageserver/session_state/object_cache.rb +162 -0
  69. data/lib/puppet-languageserver/sidecar_protocol.rb +532 -0
  70. data/lib/puppet-languageserver/uri_helper.rb +46 -0
  71. data/lib/puppet-languageserver-sidecar/cache/base.rb +36 -0
  72. data/lib/puppet-languageserver-sidecar/cache/filesystem.rb +111 -0
  73. data/lib/puppet-languageserver-sidecar/cache/null.rb +27 -0
  74. data/lib/puppet-languageserver-sidecar/facter_helper.rb +41 -0
  75. data/lib/puppet-languageserver-sidecar/puppet_environment_monkey_patches.rb +52 -0
  76. data/lib/puppet-languageserver-sidecar/puppet_helper.rb +281 -0
  77. data/lib/puppet-languageserver-sidecar/puppet_modulepath_monkey_patches.rb +146 -0
  78. data/lib/puppet-languageserver-sidecar/puppet_monkey_patches.rb +9 -0
  79. data/lib/puppet-languageserver-sidecar/puppet_parser_helper.rb +77 -0
  80. data/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb +399 -0
  81. data/lib/puppet-languageserver-sidecar/puppet_strings_monkey_patches.rb +16 -0
  82. data/lib/puppet-languageserver-sidecar/sidecar_protocol_extensions.rb +16 -0
  83. data/lib/puppet-languageserver-sidecar/workspace.rb +89 -0
  84. data/lib/puppet_debugserver.rb +164 -0
  85. data/lib/puppet_editor_services/connection/base.rb +62 -0
  86. data/lib/puppet_editor_services/connection/stdio.rb +25 -0
  87. data/lib/puppet_editor_services/connection/tcp.rb +34 -0
  88. data/lib/puppet_editor_services/handler/base.rb +16 -0
  89. data/lib/puppet_editor_services/handler/debug_adapter.rb +63 -0
  90. data/lib/puppet_editor_services/handler/json_rpc.rb +133 -0
  91. data/lib/puppet_editor_services/logging.rb +45 -0
  92. data/lib/puppet_editor_services/protocol/base.rb +27 -0
  93. data/lib/puppet_editor_services/protocol/debug_adapter.rb +135 -0
  94. data/lib/puppet_editor_services/protocol/debug_adapter_messages.rb +171 -0
  95. data/lib/puppet_editor_services/protocol/json_rpc.rb +241 -0
  96. data/lib/puppet_editor_services/protocol/json_rpc_messages.rb +200 -0
  97. data/lib/puppet_editor_services/server/base.rb +42 -0
  98. data/lib/puppet_editor_services/server/stdio.rb +85 -0
  99. data/lib/puppet_editor_services/server/tcp.rb +349 -0
  100. data/lib/puppet_editor_services/server.rb +15 -0
  101. data/lib/puppet_editor_services/version.rb +36 -0
  102. data/lib/puppet_editor_services.rb +8 -0
  103. data/lib/puppet_languageserver.rb +263 -0
  104. data/lib/puppet_languageserver_sidecar.rb +361 -0
  105. data/puppet-debugserver +11 -0
  106. data/puppet-editor-services.gemspec +29 -0
  107. data/puppet-languageserver +15 -0
  108. data/puppet-languageserver-sidecar +14 -0
  109. metadata +240 -0
data/Gemfile ADDED
@@ -0,0 +1,53 @@
1
+ source ENV['GEM_SOURCE'] || "https://rubygems.org"
2
+
3
+ # -=-=-=-=-=- WARNING -=-=-=-=-=-
4
+ # There should be NO runtime gem dependencies here. In production this code will be running using the Ruby
5
+ # runtime provided by Puppet. That means no native extensions and NO BUNDLER. All runtime dependences should
6
+ # be re-vendored and then the load path modified appropriately.
7
+ #
8
+ # This gemfile only exists to help when developing the language server and running tests
9
+ # -=-=-=-=-=- WARNING -=-=-=-=-=-
10
+
11
+ group :development do
12
+ gem 'rake', '>= 10.4', :require => false
13
+ gem 'rspec', '>= 3.2', :require => false
14
+ gem 'puppet-lint', '~> 4.0', :require => false
15
+ gem 'puppetfile-resolver', '~> 0.6.2', :require => false
16
+ gem 'yard', '~> 0.9.28', :require => false
17
+ gem "rubocop", '~> 1.64.0', :require => false
18
+ gem "rubocop-performance", '~> 1.16', :require => false
19
+ gem "rubocop-rspec", '~> 3.0', :require => false
20
+ gem 'simplecov', :require => false
21
+ gem 'simplecov-console', :require => false
22
+
23
+ if ENV['PUPPET_GEM_VERSION']
24
+ gem 'puppet', ENV['PUPPET_GEM_VERSION'], :require => false
25
+ else
26
+ gem 'puppet', :require => false
27
+ end
28
+
29
+ case RUBY_PLATFORM
30
+ when /darwin/
31
+ gem 'CFPropertyList'
32
+ end
33
+
34
+ gem "win32-dir", "<= 0.4.9", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
35
+ gem "win32-eventlog", "<= 0.6.5", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
36
+ gem "win32-process", "<= 0.7.5", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
37
+ gem "win32-security", "<= 0.2.5", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
38
+ gem "win32-service", "<= 0.8.8", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
39
+
40
+ # Gems for building release tarballs etc.
41
+ gem "archive-zip", :require => false
42
+ gem "minitar" , :require => false
43
+ end
44
+
45
+ # Evaluate Gemfile.local if it exists
46
+ if File.exist? "#{__FILE__}.local"
47
+ eval(File.read("#{__FILE__}.local"), binding)
48
+ end
49
+
50
+ # Evaluate ~/.gemfile if it exists
51
+ if File.exist?(File.join(Dir.home, '.gemfile'))
52
+ eval(File.read(File.join(Dir.home, '.gemfile')), binding)
53
+ end
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2017 Glenn Sarti, James Pogran
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,308 @@
1
+ # Puppet Editor Services
2
+
3
+ [![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/puppet-editor-services/blob/main/CODEOWNERS)
4
+ ![ci](https://github.com/puppetlabs/puppet-editor-services/actions/workflows/ci.yml/badge.svg)
5
+ ![GitHub release (latest by date)](https://img.shields.io/github/v/release/puppetlabs/puppet-editor-services)
6
+
7
+ A ruby based implementation of a [Language Server](https://github.com/Microsoft/language-server-protocol) and [Debug Server](https://github.com/microsoft/debug-adapter-protocol) for the Puppet Language. Integrate this into your editor to benefit from full Puppet Language support, such as syntax hightlighting, linting, hover support and more.
8
+
9
+ ## Requirements
10
+
11
+ * Puppet 7 or above
12
+
13
+ * Ruby 2.7 or above
14
+
15
+ ## Setting up editor services for development
16
+
17
+ * Ensure a modern ruby is installed (2.7+)
18
+
19
+ The editor services support Puppet 7.0.0 and above
20
+
21
+ * Clone this repository
22
+
23
+ ```bash
24
+ > git clone https://github.com/puppetlabs/puppet-editor-services.git
25
+
26
+ > cd puppet-editor-services
27
+ ```
28
+
29
+ * Bundle the development gems
30
+
31
+ ```bash
32
+ > bundle install
33
+
34
+ ... < lots of text >
35
+ ```
36
+
37
+ * Installed vendored gems
38
+
39
+ ```bash
40
+ > bundle exec rake gem_revendor
41
+
42
+ ... < lots of text >
43
+ ```
44
+
45
+ # Language Server
46
+
47
+ ## How to run the Language Server for Development
48
+
49
+ By default the language server will stop if no connection is made within 10 seconds and will also stop after a client disconnects. Adding `--debug=stdout` will log messages to the console
50
+
51
+ ```bash
52
+ > bundle exec ruby ./puppet-languageserver --debug=stdout
53
+ I, [2018-12-05T15:19:51.853802 #28756] INFO -- : Language Server is v0.16.0
54
+ I, [2018-12-05T15:19:51.854809 #28756] INFO -- : Using Puppet v5.5.8
55
+ D, [2018-12-05T15:19:51.856726 #28756] DEBUG -- : Detected additional puppet settings []
56
+ I, [2018-12-05T15:19:51.867798 #28756] INFO -- : Initializing Puppet Helper...
57
+ D, [2018-12-05T15:19:51.867798 #28756] DEBUG -- : Initializing Document Store...
58
+ I, [2018-12-05T15:19:51.868726 #28756] INFO -- : Initializing settings...
59
+ I, [2018-12-05T15:19:51.870728 #28756] INFO -- : Starting RPC Server...
60
+ D, [2018-12-05T15:19:51.870728 #28756] DEBUG -- : Using Simple TCP
61
+ I, [2018-12-05T15:19:51.871729 #28756] INFO -- : Using Facter v2.5.1
62
+ I, [2018-12-05T15:19:51.871729 #28756] INFO -- : Preloading Puppet Types (Async)...
63
+ I, [2018-12-05T15:19:51.872728 #28756] INFO -- : Preloading Facter (Async)...
64
+ I, [2018-12-05T15:19:51.873727 #28756] INFO -- : Preloading Functions (Async)...
65
+ I, [2018-12-05T15:19:51.876727 #28756] INFO -- : Preloading Classes (Async)...
66
+ D, [2018-12-05T15:19:51.876727 #28756] DEBUG -- : SidecarQueue Thread: Running sidecar ["ruby", "C:/Source/puppet-editor-services/puppet-languageserver-sidecar", "--action", "default_types", "--feature-flags="]
67
+ D, [2018-12-05T15:19:51.899795 #28756] DEBUG -- : SidecarQueue Thread: Running sidecar ["ruby", "C:/Source/puppet-editor-services/puppet-languageserver-sidecar", "--action", "default_functions", "--feature-flags="]
68
+ D, [2018-12-05T15:19:51.919794 #28756] DEBUG -- : TCPSRV: Services running. Press ^C to stop
69
+ D, [2018-12-05T15:19:51.920795 #28756] DEBUG -- : TCPSRV: Will stop the server in 10 seconds if no connection is made.
70
+ D, [2018-12-05T15:19:51.921809 #28756] DEBUG -- : TCPSRV: Will stop the server when client disconnects
71
+ LANGUAGE SERVER RUNNING localhost:55087
72
+ D, [2018-12-05T15:19:51.923800 #28756] DEBUG -- : TCPSRV: Started listening on localhost:55087.
73
+ A, [2018-12-05T15:19:54.520501 #28756] ANY -- : SidecarQueue Thread: Calling sidecar with --action default_functions --feature-flags= returned exitcode 0,
74
+ D, [2018-12-05T15:19:54.532525 #28756] DEBUG -- : SidecarQueue Thread: default_functions returned 270 items
75
+ D, [2018-12-05T15:19:54.533522 #28756] DEBUG -- : SidecarQueue Thread: Running sidecar ["ruby", "C:/Source/puppet-editor-services/puppet-languageserver-sidecar", "--action", "default_classes", "--feature-flags="]
76
+ A, [2018-12-05T15:19:54.576503 #28756] ANY -- : SidecarQueue Thread: Calling sidecar with --action default_types --feature-flags= returned exitcode 0,
77
+ D, [2018-12-05T15:19:54.638503 #28756] DEBUG -- : SidecarQueue Thread: default_types returned 81 items
78
+ A, [2018-12-05T15:19:56.732112 #28756] ANY -- : SidecarQueue Thread: Calling sidecar with --action default_classes --feature-flags= returned exitcode 0,
79
+ D, [2018-12-05T15:19:56.732112 #28756] DEBUG -- : SidecarQueue Thread: default_classes returned 0 items
80
+ ...
81
+ D, [2018-12-05T15:20:03.319045 #28756] DEBUG -- : TCPSRV: No connection has been received in 10 seconds. Shutting down server.
82
+ D, [2018-12-05T15:20:03.320049 #28756] DEBUG -- : TCPSRV: Stopping services
83
+ D, [2018-12-05T15:20:03.377052 #28756] DEBUG -- : TCPSRV: Stopped listening on localhost:55087
84
+ D, [2018-12-05T15:20:03.377052 #28756] DEBUG -- : TCPSRV: Started shutdown process. Press ^C to force quit.
85
+ D, [2018-12-05T15:20:03.378052 #28756] DEBUG -- : TCPSRV: Stopping services
86
+ D, [2018-12-05T15:20:03.379050 #28756] DEBUG -- : TCPSRV: Waiting for workers to cycle down
87
+ I, [2018-12-05T15:20:03.632011 #28756] INFO -- : Language Server exited.
88
+ ```
89
+
90
+ To make the server run continuously add `--timeout=0` and `--no-stop` to the command line. For example;
91
+
92
+ ```bash
93
+ > bundle exec ruby ./puppet-languageserver --debug=stdout --timeout=0 --no-stop
94
+ I, [2018-12-05T15:20:56.302414 #29752] INFO -- : Language Server is v0.16.0
95
+ I, [2018-12-05T15:20:56.303391 #29752] INFO -- : Using Puppet v5.5.8
96
+ D, [2018-12-05T15:20:56.306343 #29752] DEBUG -- : Detected additional puppet settings []
97
+ I, [2018-12-05T15:20:56.318333 #29752] INFO -- : Initializing Puppet Helper...
98
+ D, [2018-12-05T15:20:56.318333 #29752] DEBUG -- : Initializing Document Store...
99
+ I, [2018-12-05T15:20:56.319346 #29752] INFO -- : Initializing settings...
100
+ I, [2018-12-05T15:20:56.321337 #29752] INFO -- : Starting RPC Server...
101
+ D, [2018-12-05T15:20:56.321337 #29752] DEBUG -- : Using Simple TCP
102
+ I, [2018-12-05T15:20:56.322332 #29752] INFO -- : Using Facter v2.5.1
103
+ I, [2018-12-05T15:20:56.323335 #29752] INFO -- : Preloading Puppet Types (Async)...
104
+ I, [2018-12-05T15:20:56.325337 #29752] INFO -- : Preloading Facter (Async)...
105
+ I, [2018-12-05T15:20:56.326335 #29752] INFO -- : Preloading Functions (Async)...
106
+ I, [2018-12-05T15:20:56.327333 #29752] INFO -- : Preloading Classes (Async)...
107
+ ...
108
+ D, [2018-12-05T15:20:56.365334 #29752] DEBUG -- : TCPSRV: Services running. Press ^C to stop
109
+ LANGUAGE SERVER RUNNING localhost:55180
110
+ D, [2018-12-05T15:20:56.374333 #29752] DEBUG -- : TCPSRV: Started listening on localhost:55180.
111
+ ...
112
+ ```
113
+
114
+ ## How to run the Language Server in Production
115
+
116
+ * Ensure that Puppet Agent is installed
117
+ * [Linux](https://puppet.com/docs/puppet/latest/install_agents.html#install_nix_agents)
118
+ * [Windows](https://puppet.com/docs/puppet/latest/install_agents.html#install_windows_agents)
119
+ * [macOS](https://puppet.com/docs/puppet/latest/install_agents.html#install_mac_agents)
120
+
121
+ * Run the `puppet-languageserver` with ruby
122
+
123
+ > On Windows you need to run ruby with the `Puppet Command Prompt` which can be found in the Start Menu. This enables the Puppet Agent ruby environment.
124
+
125
+ ```bash
126
+ > ruby puppet-languageserver
127
+ LANGUAGE SERVER RUNNING 127.0.0.1:55086
128
+ ```
129
+
130
+ > Note the language server will stop after 10 seconds if no client connection is made.
131
+
132
+ Note that the Language Server will use TCP as the default transport on `localhost` at a random port. The IP Address and Port can be changed using the `--ip` and `--port` arguments respectively. For example to listen on all interfaces on port 9000;
133
+
134
+ ```bash
135
+ > ruby ./puppet-languageserver --ip=0.0.0.0 --port=9000
136
+ ```
137
+
138
+ To change the protocol to STDIO, that is using STDOUT and STDIN, use the `--stdio` argument.
139
+
140
+ ## Command line arguments
141
+
142
+ ```bash
143
+ Usage: puppet-languageserver.rb [options]
144
+ -p, --port=PORT TCP Port to listen on. Default is random port
145
+ -i, --ip=ADDRESS IP Address to listen on (0.0.0.0 for all interfaces). Default is localhost
146
+ -c, --no-stop Do not stop the language server once a client disconnects. Default is to stop
147
+ -t, --timeout=TIMEOUT Stop the language server if a client does not connection within TIMEOUT seconds. A value of zero will not timeout. Default is 10 seconds
148
+ -d, --no-preload ** DEPRECATED ** Do not preload Puppet information when the language server starts. Default is to preload
149
+ --debug=DEBUG Output debug information. Either specify a filename or 'STDOUT'. Default is no debug output
150
+ -s, --slow-start Delay starting the Language Server until Puppet initialisation has completed. Default is to start fast
151
+ --stdio Runs the server in stdio mode, without a TCP listener
152
+ --enable-file-cache ** DEPRECATED ** Enables the file system cache for Puppet Objects (types, class etc.)
153
+ --[no-]cache Enable or disable all caching inside the sidecar. By default caching is enabled.
154
+ --feature-flags=FLAGS A list of comma delimited feature flags
155
+ --puppet-settings=TEXT Comma delimited list of settings to pass into Puppet e.g. --vardir,/opt/test-fixture
156
+ --local-workspace=PATH The workspace or file path that will be used to provide module-specific functionality. Default is no workspace path.
157
+ -h, --help Prints this help
158
+ -v, --version Prints the Langauge Server version
159
+ ```
160
+
161
+ # Language Server Sidecar
162
+
163
+ ## How to run the Language Server for Development
164
+
165
+ The Language Server Sidecar is a process used by the Language Server to get information about Puppet's environment, for example, all available functions, classes, and custom types. This tool is typically only run by the Language Server itself, but it can be used to diagnose issues.
166
+
167
+ The sidecar is told to perform an action (using the `action`) parameter and then, by default, outputs the JSON encoded result to STDOUT. This can be changed to a text file using the `--output=PATH` argument.
168
+
169
+ Note that using the `--debug=STDOUT` option without directing the output to a text file will generate output on STDOUT which cannot be deserialized correctly. Typically this only used by a developer to inspect what the Sidecar is doing.
170
+
171
+ ### Example usage
172
+
173
+ #### Confirm that the Sidecar loads correctly
174
+
175
+ The `noop` action just outputs an empty JSON array but can be used to confirm that the Sidecar does not error while loading Puppet.
176
+
177
+ ```bash
178
+ > bundle exec ruby ./puppet-languageserver-sidecar --action=noop
179
+ []
180
+ ```
181
+
182
+ #### Output all default Puppet Types
183
+
184
+ ```bash
185
+ > bundle exec ruby ./puppet-languageserver-sidecar --action=default_types
186
+ [{"key":"anchor","calling_source":"puppet/cache/lib/puppet/type/anchor.rb","sou ...
187
+ ```
188
+
189
+ #### Output all default Puppet Functions with a different puppet configuration, and debug information
190
+
191
+ ```bash
192
+ > bundle exec ruby ./puppet-languageserver-sidecar --action=default_types --puppet-settings=--vardir,./test/vardir,--confdir,./test/confdir --debug=STDOUT
193
+ I, [2018-12-05T15:42:56.679837 #51864] INFO -- : Language Server Sidecar is v0.16.0
194
+ I, [2018-12-05T15:42:56.679837 #51864] INFO -- : Using Puppet v5.5.8
195
+ D, [2018-12-05T15:42:56.680820 #51864] DEBUG -- : Detected additional puppet settings ["--vardir", "./test/vardir", "--confdir", "./test/confdir"]
196
+ D, [2018-12-05T15:42:56.690876 #51864] DEBUG -- : [PuppetHelper::load_functions] Starting
197
+ D, [2018-12-05T15:42:56.752804 #51864] DEBUG -- : [PuppetLanguageServerSidecar::load] Loading lib/puppet/parser/functions/assert_type.rb from cache
198
+ ...
199
+ [{"key":"debug","calling_source":"lib/puppet/parser/functions.rb", ...
200
+ ```
201
+
202
+ #### Output all Puppet Classes in a workspace directory
203
+
204
+ ```bash
205
+ > bundle exec ruby ./puppet-languageserver-sidecar --action=workspace_classes --local-workspace=C:\source\puppetlabs-sqlserver
206
+ [{"key":"sqlserver::config","calling_source":"C:/Source/puppetlabs-sqlserver/manifests/config.pp","source":"C:/Source/puppetlabs-sqlserver/manifests/config.pp","line":25,"ch...
207
+ ```
208
+
209
+ ## Command line arguments
210
+
211
+ ```bash
212
+ Usage: puppet-languageserver-sidecar.rb [options]
213
+ -a, --action=NAME The action for the sidecar to take. Expected ["noop", "default_classes", "default_functions", "default_types", "node_graph", "resource_list", "workspace_classes", "workspace_functions", "workspace_types"]
214
+ -c, --action-parameters=JSON JSON Encoded string containing the parameters for the sidecar action
215
+ -w, --local-workspace=PATH The workspace or file path that will be used to provide module-specific functionality. Default is no workspace path
216
+ -o, --output=PATH The file to save the output from the sidecar. Default is output to STDOUT
217
+ -p, --puppet-settings=TEXT Comma delimited list of settings to pass into Puppet e.g. --vardir,/opt/test-fixture
218
+ -f, --feature-flags=FLAGS A list of comma delimited feature flags to pass the the sidecar
219
+ -n, --[no-]cache Enable or disable all caching inside the sidecar. By default caching is enabled.
220
+ --debug=DEBUG Output debug information. Either specify a filename or 'STDOUT'. Default is no debug output
221
+ -h, --help Prints this help
222
+ -v, --version Prints the Langauge Server version
223
+ ```
224
+
225
+ # Debug Server
226
+
227
+ ## How to run the Debug Server for Development
228
+
229
+ By default the debug server will stop if no connection is made within 10 seconds and will also stop after a client disconnects. Adding `--debug=stdout` will log messages to the console
230
+
231
+ ```bash
232
+ > bundle exec ruby ./puppet-debugserver --debug=stdout
233
+ I, [2018-04-17T14:19:24.131869 #6940] INFO -- : Debug Server is v0.10.0
234
+ I, [2018-04-17T14:19:24.132871 #6940] INFO -- : Starting RPC Server...
235
+ D, [2018-04-17T14:19:24.135373 #6940] DEBUG -- : TCPSRV: Services running. Press ^C to stop
236
+ D, [2018-04-17T14:19:24.135870 #6940] DEBUG -- : TCPSRV: Will stop the server in 10 seconds if no connection is made.
237
+ D, [2018-04-17T14:19:24.135870 #6940] DEBUG -- : TCPSRV: Will stop the server when client disconnects
238
+ DEBUG SERVER RUNNING 127.0.0.1:8082
239
+ D, [2018-04-17T14:19:24.136871 #6940] DEBUG -- : TCPSRV: Started listening on 127.0.0.1:8082.
240
+ D, [2018-04-17T14:19:34.140900 #6940] DEBUG -- : TCPSRV: No connection has been received in 10 seconds. Shutting down server.
241
+ D, [2018-04-17T14:19:34.140900 #6940] DEBUG -- : TCPSRV: Stopping services
242
+ D, [2018-04-17T14:19:34.141400 #6940] DEBUG -- : TCPSRV: Stopped listening on 127.0.0.1:8082
243
+ D, [2018-04-17T14:19:34.141900 #6940] DEBUG -- : TCPSRV: Started shutdown process. Press ^C to force quit.
244
+ D, [2018-04-17T14:19:34.141900 #6940] DEBUG -- : TCPSRV: Stopping services
245
+ D, [2018-04-17T14:19:34.142401 #6940] DEBUG -- : TCPSRV: Waiting for workers to cycle down
246
+ I, [2018-04-17T14:19:34.150402 #6940] INFO -- : Debug Server exited.
247
+ ```
248
+
249
+ To make the server run continuously add `--timeout=0` to the command line. For example;
250
+
251
+ ```bash
252
+ > bundle exec ruby ./puppet-debugserver --debug=stdout --timeout=0
253
+ I, [2018-04-17T14:21:10.542332 #12424] INFO -- : Debug Server is v0.10.0
254
+ I, [2018-04-17T14:21:10.543334 #12424] INFO -- : Starting RPC Server...
255
+ D, [2018-04-17T14:21:10.545836 #12424] DEBUG -- : TCPSRV: Services running. Press ^C to stop
256
+ D, [2018-04-17T14:21:10.546336 #12424] DEBUG -- : TCPSRV: Will stop the server when client disconnects
257
+ DEBUG SERVER RUNNING 127.0.0.1:8082
258
+ D, [2018-04-17T14:21:10.546834 #12424] DEBUG -- : TCPSRV: Started listening on 127.0.0.1:8082.
259
+ ...
260
+ ```
261
+
262
+ ## How to run the Debug Server for Production
263
+
264
+ * Ensure that Puppet Agent is installed
265
+ * [Linux](https://puppet.com/docs/puppet/latest/install_agents.html#install_nix_agents)
266
+ * [Windows](https://puppet.com/docs/puppet/latest/install_agents.html#install_windows_agents)
267
+ * [macOS](https://puppet.com/docs/puppet/latest/install_agents.html#install_mac_agents)
268
+
269
+ * Run the `puppet-debugserver` with ruby
270
+
271
+ > On Windows you need to run ruby with the `Puppet Command Prompt` which can be found in the Start Menu. This enables the Puppet Agent ruby environment.
272
+
273
+ ```bash
274
+ > ruby puppet-debugserver
275
+ DEBUG SERVER RUNNING 127.0.0.1:8082
276
+ ```
277
+
278
+ Note the debug server will stop after 10 seconds if no client connection is made.
279
+
280
+ ## Command line arguments
281
+
282
+ ```bash
283
+ Usage: puppet-debugserver.rb [options]
284
+ -p, --port=PORT TCP Port to listen on. Default is random port}
285
+ -i, --ip=ADDRESS IP Address to listen on (0.0.0.0 for all interfaces). Default is localhost
286
+ -t, --timeout=TIMEOUT Stop the Debug Server if a client does not connection within TIMEOUT seconds. A value of zero will not timeout. Default is 10 seconds
287
+ --debug=DEBUG Output debug information. Either specify a filename or 'STDOUT'. Default is no debug output
288
+ -h, --help Prints this help
289
+ -v, --version Prints the Debug Server version
290
+ ```
291
+
292
+ ## License
293
+
294
+ This codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.
295
+
296
+ # Other information
297
+
298
+ ## Reporting bugs
299
+
300
+ If you find a bug in puppet-editor-services or its results, please create an issue in the [repo issues tracker](https://github.com/puppetlabs/puppet-editor-services/issues). Bonus points will be awarded if you also include a patch that fixes the issue.
301
+
302
+ ## Development
303
+
304
+ If you run into an issue with this tool or would like to request a feature you can raise a PR with your suggested changes. Alternatively, you can raise a Github issue with a feature request or to report any bugs. Every other Tuesday the DevX team holds office hours in the Puppet Community Slack, where you can ask questions about this and any other supported tools. This session runs at 15:00 (GMT) for about an hour.
305
+
306
+ ## Why are there vendored gems and why only native ruby
307
+
308
+ When used by editors this language server will be running using the Ruby runtime provided by Puppet Agent. That means no native extensions and no bundler. Also, only the gems provided by Puppet Agent would be available by default. To work around this limitation all runtime dependencies should be re-vendored and then the load path modified appropriately.