openvox-editor-services 3.1.1 → 3.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -12
- data/Gemfile +16 -13
- data/README.md +147 -165
- data/RELEASE.md +1 -1
- data/lib/dsp/dsp_base.rb +2 -1
- data/lib/lsp/lsp_base.rb +2 -1
- data/lib/openvox_agent_rubygems.rb +2 -1
- data/lib/openvox_runtime.rb +5 -1
- data/lib/puppet-debugserver/debug_session/break_points.rb +1 -1
- data/lib/puppet-debugserver/debug_session/hook_handlers.rb +1 -1
- data/lib/puppet-languageserver/manifest/completion_provider.rb +1 -1
- data/lib/puppet-languageserver/manifest/format_on_type_provider.rb +3 -2
- data/lib/puppet-languageserver/manifest/hover_provider.rb +1 -1
- data/lib/puppet-languageserver/manifest/signature_provider.rb +3 -3
- data/lib/puppet-languageserver/puppetfile/validation_provider.rb +1 -1
- data/lib/puppet-languageserver/session_state/document_store.rb +5 -5
- data/lib/puppet-languageserver/session_state/language_client.rb +2 -2
- data/lib/puppet-languageserver/sidecar_protocol.rb +20 -11
- data/lib/puppet-languageserver-sidecar/cache/filesystem.rb +2 -2
- data/lib/puppet-languageserver-sidecar/puppet_helper.rb +5 -6
- data/lib/puppet-languageserver-sidecar/puppet_parser_helper.rb +4 -4
- data/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb +2 -1
- data/lib/puppet-languageserver-sidecar/workspace.rb +2 -2
- data/lib/puppet_editor_services/protocol/debug_adapter_messages.rb +2 -1
- data/lib/puppet_editor_services/protocol/json_rpc_messages.rb +2 -1
- data/lib/puppet_editor_services/server/stdio.rb +2 -2
- data/lib/puppet_editor_services/server/tcp.rb +1 -4
- data/lib/puppet_editor_services/version.rb +1 -1
- data/lib/puppet_languageserver.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ced2731b011c871cca3b491fbc8d1a80a3145c5c734e4e6280d971d3d9bb16c
|
|
4
|
+
data.tar.gz: 66bb67ee45ea6b0366f19f4b6fe02fea140a9cb52e76cd29cb3a4e6d8228842e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 645deea766c6d0b2b03cf6fe8810d289e9afd19199698b5767e28c8b0ee3f390155132407b122b7c4528d83b130ed92bf1dc88b1aea923626f69668555a5100f
|
|
7
|
+
data.tar.gz: d3e7069ad80724af6bfa7d743bdc3de1c27a82cb8ef8f0431cc8dd8b888a5f316957518a5c6d78856b6b8458551e197ac263652c4a2882cdd259e3050d8a3fc7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [3.1.
|
|
3
|
+
## [3.1.2](https://github.com/voxpupuli/openvox-editor-services/tree/3.1.2) (2026-10-30)
|
|
4
4
|
|
|
5
|
-
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/v3.1.
|
|
5
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/v3.1.1...3.1.2)
|
|
6
|
+
|
|
7
|
+
**Fixed bugs:**
|
|
8
|
+
|
|
9
|
+
- fix: recognize packaged OpenVox Agent Ruby on Windows [\#71](https://github.com/voxpupuli/openvox-editor-services/pull/71) ([rwaffen](https://github.com/rwaffen))
|
|
10
|
+
- fix: Rubocop Lint/\* Offences [\#50](https://github.com/voxpupuli/openvox-editor-services/pull/50) ([rwaffen](https://github.com/rwaffen))
|
|
11
|
+
- fix: Incomplete string escaping or encoding [\#49](https://github.com/voxpupuli/openvox-editor-services/pull/49) ([rwaffen](https://github.com/rwaffen))
|
|
12
|
+
- fix: handle security/code-scanning/1 by using File instead of IO [\#47](https://github.com/voxpupuli/openvox-editor-services/pull/47) ([rwaffen](https://github.com/rwaffen))
|
|
13
|
+
|
|
14
|
+
**Merged pull requests:**
|
|
15
|
+
|
|
16
|
+
- docs: update readme to reflect the state of the gem [\#74](https://github.com/voxpupuli/openvox-editor-services/pull/74) ([rwaffen](https://github.com/rwaffen))
|
|
17
|
+
- ci: merge method is set by merge\_group automatically [\#46](https://github.com/voxpupuli/openvox-editor-services/pull/46) ([rwaffen](https://github.com/rwaffen))
|
|
18
|
+
- test: try merge queue [\#45](https://github.com/voxpupuli/openvox-editor-services/pull/45) ([rwaffen](https://github.com/rwaffen))
|
|
19
|
+
- add some meta updates: switch to renovate, remove pr template, extend release docs [\#17](https://github.com/voxpupuli/openvox-editor-services/pull/17) ([rwaffen](https://github.com/rwaffen))
|
|
20
|
+
|
|
21
|
+
## [v3.1.1](https://github.com/voxpupuli/openvox-editor-services/tree/v3.1.1) (2026-07-18)
|
|
22
|
+
|
|
23
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/v3.1.0...v3.1.1)
|
|
6
24
|
|
|
7
25
|
**Fixed bugs:**
|
|
8
26
|
|
|
@@ -171,15 +189,15 @@
|
|
|
171
189
|
|
|
172
190
|
## [0.7.2](https://github.com/voxpupuli/openvox-editor-services/tree/0.7.2) (2017-10-27)
|
|
173
191
|
|
|
174
|
-
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.7.
|
|
192
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.7.0...0.7.2)
|
|
175
193
|
|
|
176
|
-
## [0.7.
|
|
194
|
+
## [0.7.0](https://github.com/voxpupuli/openvox-editor-services/tree/0.7.0) (2017-09-20)
|
|
177
195
|
|
|
178
|
-
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.7.
|
|
196
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.7.1...0.7.0)
|
|
179
197
|
|
|
180
|
-
## [0.7.
|
|
198
|
+
## [0.7.1](https://github.com/voxpupuli/openvox-editor-services/tree/0.7.1) (2017-09-20)
|
|
181
199
|
|
|
182
|
-
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.6.0...0.7.
|
|
200
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.6.0...0.7.1)
|
|
183
201
|
|
|
184
202
|
## [0.6.0](https://github.com/voxpupuli/openvox-editor-services/tree/0.6.0) (2017-07-21)
|
|
185
203
|
|
|
@@ -195,15 +213,15 @@
|
|
|
195
213
|
|
|
196
214
|
## [0.4.5](https://github.com/voxpupuli/openvox-editor-services/tree/0.4.5) (2017-06-16)
|
|
197
215
|
|
|
198
|
-
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.4.
|
|
216
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.4.0...0.4.5)
|
|
199
217
|
|
|
200
|
-
## [0.4.
|
|
218
|
+
## [0.4.0](https://github.com/voxpupuli/openvox-editor-services/tree/0.4.0) (2017-06-16)
|
|
201
219
|
|
|
202
|
-
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.4.
|
|
220
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/0.4.2...0.4.0)
|
|
203
221
|
|
|
204
|
-
## [0.4.
|
|
222
|
+
## [0.4.2](https://github.com/voxpupuli/openvox-editor-services/tree/0.4.2) (2017-06-16)
|
|
205
223
|
|
|
206
|
-
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/804559931cdefe5364e463ee904f68c1a8d7ed39...0.4.
|
|
224
|
+
[Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/804559931cdefe5364e463ee904f68c1a8d7ed39...0.4.2)
|
|
207
225
|
|
|
208
226
|
|
|
209
227
|
|
data/Gemfile
CHANGED
|
@@ -9,23 +9,25 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
|
|
9
9
|
# -=-=-=-=-=- WARNING -=-=-=-=-=-
|
|
10
10
|
|
|
11
11
|
group :development do
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
# JSON 3 support requires keyword options in the sidecar/OpenVox JSON loaders
|
|
13
|
+
# and replacing JSON::PRETTY_STATE_PROTOTYPE in OpenVox's JSON dumper.
|
|
14
|
+
gem 'json', "< 3.0", :require => false
|
|
15
|
+
gem 'openfact', '>= 5.1', '< 7', :require => false
|
|
14
16
|
gem 'openvox-strings', '~> 7.1', :require => false
|
|
15
17
|
gem 'puppetfile-resolver', '~> 0.6.2', :require => false
|
|
16
18
|
gem 'rake', '>= 10.4', :require => false
|
|
17
19
|
gem 'rspec', '>= 3.2', :require => false
|
|
18
|
-
gem 'rubocop-capybara', '~>
|
|
19
|
-
gem 'rubocop-factory_bot', '~> 2.
|
|
20
|
-
gem 'rubocop-rspec_rails', '~> 2.
|
|
20
|
+
gem 'rubocop-capybara', '~> 3.1.0', :require => false
|
|
21
|
+
gem 'rubocop-factory_bot', '~> 2.28.0', :require => false
|
|
22
|
+
gem 'rubocop-rspec_rails', '~> 2.33.0', :require => false
|
|
21
23
|
gem 'simplecov-console', :require => false
|
|
22
24
|
gem 'simplecov', :require => false
|
|
23
25
|
gem 'syslog', '~> 0.4', :require => false unless Gem.win_platform?
|
|
24
26
|
gem 'voxpupuli-puppet-lint-plugins', '= 7.0.0', :require => false
|
|
25
27
|
gem 'yard', '~> 0.9.28', :require => false
|
|
26
|
-
gem "rubocop-performance", '~> 1.
|
|
27
|
-
gem "rubocop-rspec", '~> 3.
|
|
28
|
-
gem "rubocop", '~> 1.
|
|
28
|
+
gem "rubocop-performance", '~> 1.27.0', :require => false
|
|
29
|
+
gem "rubocop-rspec", '~> 3.10.0', :require => false
|
|
30
|
+
gem "rubocop", '~> 1.92.0', :require => false
|
|
29
31
|
|
|
30
32
|
if ENV['OPENVOX_GEM_VERSION']
|
|
31
33
|
gem 'openvox', ENV['OPENVOX_GEM_VERSION'], :require => false
|
|
@@ -38,11 +40,12 @@ group :development do
|
|
|
38
40
|
gem 'CFPropertyList'
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
gem "win32-dir", "<= 0.
|
|
42
|
-
gem "win32-eventlog", "<= 0.6.
|
|
43
|
-
gem "win32-process", "<= 0.
|
|
44
|
-
gem "win32-security", "<= 0.
|
|
45
|
-
gem "win32-service", "<=
|
|
43
|
+
gem "win32-dir", "<= 0.7.2", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
|
|
44
|
+
gem "win32-eventlog", "<= 0.6.7", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
|
|
45
|
+
gem "win32-process", "<= 0.10.0", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
|
|
46
|
+
gem "win32-security", "<= 0.5.0", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
|
|
47
|
+
gem "win32-service", "<= 2.4.0", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
|
|
48
|
+
gem "win32ole", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
|
|
46
49
|
|
|
47
50
|
# Gems for building release tarballs etc.
|
|
48
51
|
gem "archive-zip", :require => false
|
data/README.md
CHANGED
|
@@ -6,6 +6,7 @@ The internal `Puppet` Ruby namespace and `puppet/*` protocol methods are retaine
|
|
|
6
6
|
- [OpenVox Editor Services](#openvox-editor-services)
|
|
7
7
|
- [Requirements](#requirements)
|
|
8
8
|
- [Setting up editor services for development](#setting-up-editor-services-for-development)
|
|
9
|
+
- [Build a local VSIX](#build-a-local-vsix)
|
|
9
10
|
- [Language Server](#language-server)
|
|
10
11
|
- [How to run the Language Server for Development](#how-to-run-the-language-server-for-development)
|
|
11
12
|
- [How to run the Language Server in Production](#how-to-run-the-language-server-in-production)
|
|
@@ -26,123 +27,84 @@ The internal `Puppet` Ruby namespace and `puppet/*` protocol methods are retaine
|
|
|
26
27
|
- [Other information](#other-information)
|
|
27
28
|
- [Reporting bugs](#reporting-bugs)
|
|
28
29
|
- [Development](#development)
|
|
29
|
-
- [
|
|
30
|
+
- [Packaging and runtime dependencies](#packaging-and-runtime-dependencies)
|
|
30
31
|
|
|
31
32
|
## Requirements
|
|
32
33
|
|
|
33
34
|
- OpenVox 8 or above
|
|
34
|
-
- Ruby 3.
|
|
35
|
+
- Ruby 3.4 or above
|
|
35
36
|
|
|
36
37
|
## Setting up editor services for development
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
- The editor services support OpenVox 8.0.0 and above.
|
|
40
|
-
- Clone this repository
|
|
39
|
+
Use Ruby 3.4 or above, then clone the repository and install the development dependencies:
|
|
41
40
|
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
```shell
|
|
42
|
+
git clone https://github.com/voxpupuli/openvox-editor-services.git
|
|
43
|
+
cd openvox-editor-services
|
|
44
|
+
bundle install
|
|
45
|
+
bundle exec rake gem_revendor
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
`gem_revendor` downloads runtime dependency sources and requires network access.
|
|
49
|
+
Run it before starting the servers from the checkout or running the test suites.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
The Gemfile accepts `OPENVOX_GEM_VERSION` to select the OpenVox dependency.
|
|
52
|
+
For example, to use the OpenVox 8 series as configured in CI:
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
```shell
|
|
55
|
+
export OPENVOX_GEM_VERSION='~> 8.0'
|
|
56
|
+
bundle install
|
|
54
57
|
```
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
Keep this variable set for subsequent `bundle exec` commands.
|
|
60
|
+
Without it, the Gemfile does not constrain the OpenVox version; Bundler resolves it using the available gems and lockfile.
|
|
61
|
+
When changing the requirement, run `bundle update openvox` if the existing lockfile does not satisfy it.
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
> bundle exec rake gem_revendor
|
|
63
|
+
## Build a local VSIX
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
To test the current editor-services checkout with the sibling `openvox-vscode` repository, run:
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
./scripts/build-local-vsix.sh
|
|
62
69
|
```
|
|
63
70
|
|
|
71
|
+
The script removes old local gem and VSIX build artifacts, builds the local gem, installs it and its dependencies into
|
|
72
|
+
the extension, compiles the extension, and creates
|
|
73
|
+
`../openvox-vscode/artifacts/openvox-vscode-local-<gem-version>.vsix`.
|
|
74
|
+
It requires Ruby 3.4 or newer and existing npm dependencies in `openvox-vscode`.
|
|
75
|
+
Set `RUBY`, `OPENVOX_VSCODE_DIR`, or `VSIX_OUTPUT` to override the detected Ruby, repository path, or output path.
|
|
76
|
+
|
|
64
77
|
## Language Server
|
|
65
78
|
|
|
66
79
|
### How to run the Language Server for Development
|
|
67
80
|
|
|
68
|
-
By default the language server
|
|
81
|
+
By default the language server stops if no connection is made within 10 seconds or after a client disconnects.
|
|
82
|
+
Adding `--debug=stdout` logs diagnostic messages to the console.
|
|
83
|
+
The example below shows only the readiness message; the port is selected dynamically.
|
|
69
84
|
|
|
70
85
|
```bash
|
|
71
|
-
> bundle exec ruby ./
|
|
72
|
-
I, [2018-12-05T15:19:51.853802 #28756] INFO -- : Language Server is v0.16.0
|
|
73
|
-
I, [2018-12-05T15:19:51.854809 #28756] INFO -- : Using Puppet v5.5.8
|
|
74
|
-
D, [2018-12-05T15:19:51.856726 #28756] DEBUG -- : Detected additional puppet settings []
|
|
75
|
-
I, [2018-12-05T15:19:51.867798 #28756] INFO -- : Initializing Puppet Helper...
|
|
76
|
-
D, [2018-12-05T15:19:51.867798 #28756] DEBUG -- : Initializing Document Store...
|
|
77
|
-
I, [2018-12-05T15:19:51.868726 #28756] INFO -- : Initializing settings...
|
|
78
|
-
I, [2018-12-05T15:19:51.870728 #28756] INFO -- : Starting RPC Server...
|
|
79
|
-
D, [2018-12-05T15:19:51.870728 #28756] DEBUG -- : Using Simple TCP
|
|
80
|
-
I, [2018-12-05T15:19:51.871729 #28756] INFO -- : Using Facter v2.5.1
|
|
81
|
-
I, [2018-12-05T15:19:51.871729 #28756] INFO -- : Preloading Puppet Types (Async)...
|
|
82
|
-
I, [2018-12-05T15:19:51.872728 #28756] INFO -- : Preloading Facter (Async)...
|
|
83
|
-
I, [2018-12-05T15:19:51.873727 #28756] INFO -- : Preloading Functions (Async)...
|
|
84
|
-
I, [2018-12-05T15:19:51.876727 #28756] INFO -- : Preloading Classes (Async)...
|
|
85
|
-
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="]
|
|
86
|
-
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="]
|
|
87
|
-
D, [2018-12-05T15:19:51.919794 #28756] DEBUG -- : TCPSRV: Services running. Press ^C to stop
|
|
88
|
-
D, [2018-12-05T15:19:51.920795 #28756] DEBUG -- : TCPSRV: Will stop the server in 10 seconds if no connection is made.
|
|
89
|
-
D, [2018-12-05T15:19:51.921809 #28756] DEBUG -- : TCPSRV: Will stop the server when client disconnects
|
|
86
|
+
> bundle exec ruby ./openvox-languageserver --debug=stdout
|
|
90
87
|
LANGUAGE SERVER RUNNING localhost:55087
|
|
91
|
-
D, [2018-12-05T15:19:51.923800 #28756] DEBUG -- : TCPSRV: Started listening on localhost:55087.
|
|
92
|
-
A, [2018-12-05T15:19:54.520501 #28756] ANY -- : SidecarQueue Thread: Calling sidecar with --action default_functions --feature-flags= returned exitcode 0,
|
|
93
|
-
D, [2018-12-05T15:19:54.532525 #28756] DEBUG -- : SidecarQueue Thread: default_functions returned 270 items
|
|
94
|
-
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="]
|
|
95
|
-
A, [2018-12-05T15:19:54.576503 #28756] ANY -- : SidecarQueue Thread: Calling sidecar with --action default_types --feature-flags= returned exitcode 0,
|
|
96
|
-
D, [2018-12-05T15:19:54.638503 #28756] DEBUG -- : SidecarQueue Thread: default_types returned 81 items
|
|
97
|
-
A, [2018-12-05T15:19:56.732112 #28756] ANY -- : SidecarQueue Thread: Calling sidecar with --action default_classes --feature-flags= returned exitcode 0,
|
|
98
|
-
D, [2018-12-05T15:19:56.732112 #28756] DEBUG -- : SidecarQueue Thread: default_classes returned 0 items
|
|
99
|
-
...
|
|
100
|
-
D, [2018-12-05T15:20:03.319045 #28756] DEBUG -- : TCPSRV: No connection has been received in 10 seconds. Shutting down server.
|
|
101
|
-
D, [2018-12-05T15:20:03.320049 #28756] DEBUG -- : TCPSRV: Stopping services
|
|
102
|
-
D, [2018-12-05T15:20:03.377052 #28756] DEBUG -- : TCPSRV: Stopped listening on localhost:55087
|
|
103
|
-
D, [2018-12-05T15:20:03.377052 #28756] DEBUG -- : TCPSRV: Started shutdown process. Press ^C to force quit.
|
|
104
|
-
D, [2018-12-05T15:20:03.378052 #28756] DEBUG -- : TCPSRV: Stopping services
|
|
105
|
-
D, [2018-12-05T15:20:03.379050 #28756] DEBUG -- : TCPSRV: Waiting for workers to cycle down
|
|
106
|
-
I, [2018-12-05T15:20:03.632011 #28756] INFO -- : Language Server exited.
|
|
107
88
|
```
|
|
108
89
|
|
|
109
90
|
To make the server run continuously add `--timeout=0` and `--no-stop` to the command line. For example;
|
|
110
91
|
|
|
111
92
|
```bash
|
|
112
|
-
> bundle exec ruby ./
|
|
113
|
-
|
|
114
|
-
I, [2018-12-05T15:20:56.303391 #29752] INFO -- : Using Puppet v5.5.8
|
|
115
|
-
D, [2018-12-05T15:20:56.306343 #29752] DEBUG -- : Detected additional puppet settings []
|
|
116
|
-
I, [2018-12-05T15:20:56.318333 #29752] INFO -- : Initializing Puppet Helper...
|
|
117
|
-
D, [2018-12-05T15:20:56.318333 #29752] DEBUG -- : Initializing Document Store...
|
|
118
|
-
I, [2018-12-05T15:20:56.319346 #29752] INFO -- : Initializing settings...
|
|
119
|
-
I, [2018-12-05T15:20:56.321337 #29752] INFO -- : Starting RPC Server...
|
|
120
|
-
D, [2018-12-05T15:20:56.321337 #29752] DEBUG -- : Using Simple TCP
|
|
121
|
-
I, [2018-12-05T15:20:56.322332 #29752] INFO -- : Using Facter v2.5.1
|
|
122
|
-
I, [2018-12-05T15:20:56.323335 #29752] INFO -- : Preloading Puppet Types (Async)...
|
|
123
|
-
I, [2018-12-05T15:20:56.325337 #29752] INFO -- : Preloading Facter (Async)...
|
|
124
|
-
I, [2018-12-05T15:20:56.326335 #29752] INFO -- : Preloading Functions (Async)...
|
|
125
|
-
I, [2018-12-05T15:20:56.327333 #29752] INFO -- : Preloading Classes (Async)...
|
|
126
|
-
...
|
|
127
|
-
D, [2018-12-05T15:20:56.365334 #29752] DEBUG -- : TCPSRV: Services running. Press ^C to stop
|
|
128
|
-
LANGUAGE SERVER RUNNING localhost:55180
|
|
129
|
-
D, [2018-12-05T15:20:56.374333 #29752] DEBUG -- : TCPSRV: Started listening on localhost:55180.
|
|
130
|
-
...
|
|
93
|
+
> bundle exec ruby ./openvox-languageserver --debug=stdout --timeout=0 --no-stop
|
|
94
|
+
LANGUAGE SERVER RUNNING localhost:55087
|
|
131
95
|
```
|
|
132
96
|
|
|
133
97
|
### How to run the Language Server in Production
|
|
134
98
|
|
|
135
|
-
- Ensure that
|
|
136
|
-
- [Linux](https://puppet.com/docs/puppet/latest/install_agents.html#install_nix_agents)
|
|
137
|
-
- [Windows](https://puppet.com/docs/puppet/latest/install_agents.html#install_windows_agents)
|
|
138
|
-
- [macOS](https://puppet.com/docs/puppet/latest/install_agents.html#install_mac_agents)
|
|
99
|
+
- Ensure that OpenVox Agent is installed
|
|
139
100
|
|
|
140
|
-
- Run the `
|
|
101
|
+
- Run the `openvox-languageserver` with ruby
|
|
141
102
|
|
|
142
|
-
|
|
103
|
+
On Windows, run Ruby from the `OpenVox Command Prompt` in the Start Menu.
|
|
104
|
+
This enables the OpenVox Agent Ruby environment.
|
|
143
105
|
|
|
144
106
|
```bash
|
|
145
|
-
> ruby
|
|
107
|
+
> ruby openvox-languageserver
|
|
146
108
|
LANGUAGE SERVER RUNNING 127.0.0.1:55086
|
|
147
109
|
```
|
|
148
110
|
|
|
@@ -153,31 +115,35 @@ The IP Address and Port can be changed using the `--ip` and `--port` arguments r
|
|
|
153
115
|
For example to listen on all interfaces on port 9000;
|
|
154
116
|
|
|
155
117
|
```bash
|
|
156
|
-
> ruby ./
|
|
118
|
+
> ruby ./openvox-languageserver --ip=0.0.0.0 --port=9000
|
|
157
119
|
```
|
|
158
120
|
|
|
159
121
|
To change the protocol to STDIO, that is using STDOUT and STDIN, use the `--stdio` argument.
|
|
160
122
|
|
|
161
123
|
### Command line arguments
|
|
162
124
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
125
|
+
Common options:
|
|
126
|
+
|
|
127
|
+
| Option | Behavior |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `--ip=ADDRESS` | TCP listen address; defaults to `localhost`. |
|
|
130
|
+
| `--port=PORT` | TCP listen port; defaults to a randomly selected port. |
|
|
131
|
+
| `--stdio` | Use STDIN and STDOUT instead of TCP. |
|
|
132
|
+
| `--timeout=SECONDS` | Wait for a connection for up to 10 seconds by default; `0` disables this timeout. |
|
|
133
|
+
| `--no-stop` | Keep running after a client disconnects. |
|
|
134
|
+
| `--debug=PATH` | Write diagnostic logs to a file, or use `STDOUT` for console output. |
|
|
135
|
+
| `--[no-]cache` | Enable or disable sidecar caching; enabled by default. |
|
|
136
|
+
| `--openvox-version=VERSION` | Select an OpenVox gem version; `--puppet-version` is a compatibility alias. |
|
|
137
|
+
| `--puppet-settings=SETTINGS` | Pass comma-separated settings, such as `--vardir,/path/to/vardir`. |
|
|
138
|
+
|
|
139
|
+
`--no-preload` and `--slow-start` are deprecated.
|
|
140
|
+
`--enable-file-cache` and `--local-workspace` are deprecated and have no effect.
|
|
141
|
+
The client supplies the Language Server workspace; the Sidecar's `--local-workspace` option remains supported.
|
|
142
|
+
|
|
143
|
+
For the complete option list, run:
|
|
144
|
+
|
|
145
|
+
```shell
|
|
146
|
+
bundle exec ruby ./openvox-languageserver --help
|
|
181
147
|
```
|
|
182
148
|
|
|
183
149
|
## Language Server Sidecar
|
|
@@ -200,52 +166,52 @@ Typically this only used by a developer to inspect what the Sidecar is doing.
|
|
|
200
166
|
The `noop` action just outputs an empty JSON array but can be used to confirm that the Sidecar does not error while loading Puppet.
|
|
201
167
|
|
|
202
168
|
```bash
|
|
203
|
-
> bundle exec ruby ./
|
|
169
|
+
> bundle exec ruby ./openvox-languageserver-sidecar --action=noop
|
|
204
170
|
[]
|
|
205
171
|
```
|
|
206
172
|
|
|
207
173
|
#### Output all default Puppet Types
|
|
208
174
|
|
|
209
175
|
```bash
|
|
210
|
-
> bundle exec ruby ./
|
|
176
|
+
> bundle exec ruby ./openvox-languageserver-sidecar --action=default_types
|
|
211
177
|
[{"key":"anchor","calling_source":"puppet/cache/lib/puppet/type/anchor.rb","sou ...
|
|
212
178
|
```
|
|
213
179
|
|
|
214
180
|
#### Output all default Puppet Functions with a different puppet configuration, and debug information
|
|
215
181
|
|
|
216
182
|
```bash
|
|
217
|
-
|
|
218
|
-
I, [2018-12-05T15:42:56.679837 #51864] INFO -- : Language Server Sidecar is v0.16.0
|
|
219
|
-
I, [2018-12-05T15:42:56.679837 #51864] INFO -- : Using Puppet v5.5.8
|
|
220
|
-
D, [2018-12-05T15:42:56.680820 #51864] DEBUG -- : Detected additional puppet settings ["--vardir", "./test/vardir", "--confdir", "./test/confdir"]
|
|
221
|
-
D, [2018-12-05T15:42:56.690876 #51864] DEBUG -- : [PuppetHelper::load_functions] Starting
|
|
222
|
-
D, [2018-12-05T15:42:56.752804 #51864] DEBUG -- : [PuppetLanguageServerSidecar::load] Loading lib/puppet/parser/functions/assert_type.rb from cache
|
|
223
|
-
...
|
|
224
|
-
[{"key":"debug","calling_source":"lib/puppet/parser/functions.rb", ...
|
|
183
|
+
bundle exec ruby ./openvox-languageserver-sidecar --action=default_functions --puppet-settings=--vardir,./test/vardir,--confdir,./test/confdir --debug=STDOUT
|
|
225
184
|
```
|
|
226
185
|
|
|
186
|
+
This prints diagnostic messages followed by the JSON function data.
|
|
187
|
+
Use `--output=functions.json` to save the JSON separately from the diagnostic output.
|
|
188
|
+
|
|
227
189
|
#### Output all Puppet Classes in a workspace directory
|
|
228
190
|
|
|
229
191
|
```bash
|
|
230
|
-
> bundle exec ruby ./
|
|
192
|
+
> bundle exec ruby ./openvox-languageserver-sidecar --action=workspace_classes --local-workspace=C:\source\puppetlabs-sqlserver
|
|
231
193
|
[{"key":"sqlserver::config","calling_source":"C:/Source/puppetlabs-sqlserver/manifests/config.pp","source":"C:/Source/puppetlabs-sqlserver/manifests/config.pp","line":25,"ch...
|
|
232
194
|
```
|
|
233
195
|
|
|
234
196
|
### Command line arguments for the Language Server Sidecar
|
|
235
197
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
198
|
+
Common options:
|
|
199
|
+
|
|
200
|
+
| Option | Behavior |
|
|
201
|
+
| --- | --- |
|
|
202
|
+
| `--action=NAME` | Required action, such as `noop`, `default_functions`, or `workspace_classes`. |
|
|
203
|
+
| `--action-parameters=JSON` | Supply action parameters as a JSON string. |
|
|
204
|
+
| `--local-workspace=PATH` | Set the workspace or file path for module-specific actions. |
|
|
205
|
+
| `--output=PATH` | Save JSON output to a file; defaults to STDOUT. |
|
|
206
|
+
| `--puppet-settings=SETTINGS` | Pass comma-separated settings, such as `--vardir,/path/to/vardir`. |
|
|
207
|
+
| `--[no-]cache` | Enable or disable caching; enabled by default. |
|
|
208
|
+
| `--openvox-version=VERSION` | Select an OpenVox gem version; `--puppet-version` is a compatibility alias. |
|
|
209
|
+
| `--debug=PATH` | Write diagnostic logs to a file, or use `STDOUT` for console output. |
|
|
210
|
+
|
|
211
|
+
For all supported actions and options, run:
|
|
212
|
+
|
|
213
|
+
```shell
|
|
214
|
+
bundle exec ruby ./openvox-languageserver-sidecar --help
|
|
249
215
|
```
|
|
250
216
|
|
|
251
217
|
## Debug Server
|
|
@@ -253,49 +219,32 @@ Usage: puppet-languageserver-sidecar.rb [options]
|
|
|
253
219
|
### How to run the Debug Server for Development
|
|
254
220
|
|
|
255
221
|
By default the debug server will stop if no connection is made within 10 seconds and will also stop after a client disconnects.
|
|
256
|
-
Adding `--debug=stdout`
|
|
222
|
+
Adding `--debug=stdout` logs diagnostic messages to the console.
|
|
223
|
+
The examples below show only the readiness message; the port is selected dynamically.
|
|
257
224
|
|
|
258
225
|
```bash
|
|
259
|
-
> bundle exec ruby ./
|
|
260
|
-
I, [2018-04-17T14:19:24.131869 #6940] INFO -- : Debug Server is v0.10.0
|
|
261
|
-
I, [2018-04-17T14:19:24.132871 #6940] INFO -- : Starting RPC Server...
|
|
262
|
-
D, [2018-04-17T14:19:24.135373 #6940] DEBUG -- : TCPSRV: Services running. Press ^C to stop
|
|
263
|
-
D, [2018-04-17T14:19:24.135870 #6940] DEBUG -- : TCPSRV: Will stop the server in 10 seconds if no connection is made.
|
|
264
|
-
D, [2018-04-17T14:19:24.135870 #6940] DEBUG -- : TCPSRV: Will stop the server when client disconnects
|
|
226
|
+
> bundle exec ruby ./openvox-debugserver --debug=stdout
|
|
265
227
|
DEBUG SERVER RUNNING 127.0.0.1:8082
|
|
266
|
-
D, [2018-04-17T14:19:24.136871 #6940] DEBUG -- : TCPSRV: Started listening on 127.0.0.1:8082.
|
|
267
|
-
D, [2018-04-17T14:19:34.140900 #6940] DEBUG -- : TCPSRV: No connection has been received in 10 seconds. Shutting down server.
|
|
268
|
-
D, [2018-04-17T14:19:34.140900 #6940] DEBUG -- : TCPSRV: Stopping services
|
|
269
|
-
D, [2018-04-17T14:19:34.141400 #6940] DEBUG -- : TCPSRV: Stopped listening on 127.0.0.1:8082
|
|
270
|
-
D, [2018-04-17T14:19:34.141900 #6940] DEBUG -- : TCPSRV: Started shutdown process. Press ^C to force quit.
|
|
271
|
-
D, [2018-04-17T14:19:34.141900 #6940] DEBUG -- : TCPSRV: Stopping services
|
|
272
|
-
D, [2018-04-17T14:19:34.142401 #6940] DEBUG -- : TCPSRV: Waiting for workers to cycle down
|
|
273
|
-
I, [2018-04-17T14:19:34.150402 #6940] INFO -- : Debug Server exited.
|
|
274
228
|
```
|
|
275
229
|
|
|
276
|
-
To
|
|
230
|
+
To wait for a client without a connection timeout, add `--timeout=0`.
|
|
231
|
+
The debug server still stops after the client disconnects.
|
|
277
232
|
|
|
278
233
|
```bash
|
|
279
|
-
> bundle exec ruby ./
|
|
280
|
-
I, [2018-04-17T14:21:10.542332 #12424] INFO -- : Debug Server is v0.10.0
|
|
281
|
-
I, [2018-04-17T14:21:10.543334 #12424] INFO -- : Starting RPC Server...
|
|
282
|
-
D, [2018-04-17T14:21:10.545836 #12424] DEBUG -- : TCPSRV: Services running. Press ^C to stop
|
|
283
|
-
D, [2018-04-17T14:21:10.546336 #12424] DEBUG -- : TCPSRV: Will stop the server when client disconnects
|
|
234
|
+
> bundle exec ruby ./openvox-debugserver --debug=stdout --timeout=0
|
|
284
235
|
DEBUG SERVER RUNNING 127.0.0.1:8082
|
|
285
|
-
D, [2018-04-17T14:21:10.546834 #12424] DEBUG -- : TCPSRV: Started listening on 127.0.0.1:8082.
|
|
286
|
-
...
|
|
287
236
|
```
|
|
288
237
|
|
|
289
238
|
### How to run the Debug Server for Production
|
|
290
239
|
|
|
291
240
|
- Ensure that OpenVox Agent is installed
|
|
292
|
-
- Run the `
|
|
241
|
+
- Run the `openvox-debugserver` with ruby
|
|
293
242
|
|
|
294
243
|
On Windows you need to run ruby with the `OpenVox Command Prompt` which can be found in the Start Menu.
|
|
295
244
|
This enables the OpenVox Agent ruby environment.
|
|
296
245
|
|
|
297
246
|
```bash
|
|
298
|
-
> ruby
|
|
247
|
+
> ruby openvox-debugserver
|
|
299
248
|
DEBUG SERVER RUNNING 127.0.0.1:8082
|
|
300
249
|
```
|
|
301
250
|
|
|
@@ -303,14 +252,20 @@ Note the debug server will stop after 10 seconds if no client connection is made
|
|
|
303
252
|
|
|
304
253
|
### Command line arguments for the Debug Server
|
|
305
254
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
255
|
+
Common options:
|
|
256
|
+
|
|
257
|
+
| Option | Behavior |
|
|
258
|
+
| --- | --- |
|
|
259
|
+
| `--ip=ADDRESS` | TCP listen address; defaults to `localhost`. |
|
|
260
|
+
| `--port=PORT` | TCP listen port; defaults to a randomly selected port. |
|
|
261
|
+
| `--timeout=SECONDS` | Wait for a connection for up to 10 seconds by default; `0` disables this timeout. |
|
|
262
|
+
| `--openvox-version=VERSION` | Select an OpenVox gem version; `--puppet-version` is a compatibility alias. |
|
|
263
|
+
| `--debug=PATH` | Write diagnostic logs to a file, or use `STDOUT` for console output. |
|
|
264
|
+
|
|
265
|
+
For the complete option list, run:
|
|
266
|
+
|
|
267
|
+
```shell
|
|
268
|
+
bundle exec ruby ./openvox-debugserver --help
|
|
314
269
|
```
|
|
315
270
|
|
|
316
271
|
## License
|
|
@@ -321,19 +276,46 @@ This codebase is licensed under Apache 2.0. However, the open source dependencie
|
|
|
321
276
|
|
|
322
277
|
### Reporting bugs
|
|
323
278
|
|
|
324
|
-
If you find a bug in
|
|
279
|
+
If you find a bug in OpenVox Editor Services or its results, please create an issue in the
|
|
280
|
+
[repository issue tracker](https://github.com/voxpupuli/openvox-editor-services/issues).
|
|
325
281
|
Bonus points will be awarded if you also include a patch that fixes the issue.
|
|
326
282
|
|
|
327
283
|
## Development
|
|
328
284
|
|
|
329
|
-
|
|
330
|
-
Alternatively, you can raise a Github issue with a feature request or to report any bugs.
|
|
331
|
-
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.
|
|
332
|
-
This session runs at 15:00 (GMT) for about an hour.
|
|
285
|
+
After completing the [development setup](#setting-up-editor-services-for-development), run the relevant checks:
|
|
333
286
|
|
|
334
|
-
|
|
287
|
+
```shell
|
|
288
|
+
bundle exec rake test_languageserver
|
|
289
|
+
bundle exec rake test_languageserver_sidecar
|
|
290
|
+
bundle exec rake test_debugserver
|
|
291
|
+
bundle exec rake acceptance_languageserver
|
|
292
|
+
bundle exec rake rubocop
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
The first three commands run the component specs; the acceptance suite runs separately.
|
|
296
|
+
For coverage across the three component suites, run `bundle exec rake test:coverage`.
|
|
297
|
+
CI currently runs these checks with Ruby 4.0 and `OPENVOX_GEM_VERSION='~> 8.0'`,
|
|
298
|
+
with component and acceptance tests on Linux and Windows.
|
|
299
|
+
Use the explicit tasks above; the default Rake task currently refers to an undefined `test` task.
|
|
335
300
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
301
|
+
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.
|
|
302
|
+
Alternatively, you can raise a GitHub issue with a feature request or to report any bugs.
|
|
303
|
+
|
|
304
|
+
## Packaging and runtime dependencies
|
|
305
|
+
|
|
306
|
+
Editor services can run with the Ruby runtime provided by OpenVox Agent.
|
|
307
|
+
Dependencies must be available to that runtime when the editor starts the server.
|
|
308
|
+
The repository supports two packaging paths:
|
|
309
|
+
|
|
310
|
+
- **Standalone archives:** `bundle exec rake build` runs `gem_revendor` and includes the downloaded Ruby sources from
|
|
311
|
+
`vendor/` alongside `lib/` and the root-level server scripts in ZIP and tar.gz archives.
|
|
312
|
+
The server loads these vendored dependencies through its Ruby load path, without requiring Bundler at runtime.
|
|
313
|
+
Run `bundle exec rake gem_revendor` when preparing a checkout for development and tests as described above.
|
|
314
|
+
- **Ruby gem and local VSIX:** the gemspec declares runtime dependencies, which `gem install` resolves and installs.
|
|
315
|
+
The gem contains `lib/` and `bin/`; it does not include the repository's `vendor/` directory.
|
|
316
|
+
`scripts/build-local-vsix.sh` builds this gem and installs it with its dependencies into the extension's
|
|
317
|
+
`vendor/languageserver/gems` directory, then packages the extension.
|
|
318
|
+
This path does not run `gem_revendor` and does not require Bundler at runtime.
|
|
319
|
+
|
|
320
|
+
Keep dependencies compatible with the OpenVox Agent Ruby runtime and prefer pure Ruby dependencies to avoid
|
|
321
|
+
platform-specific native extension builds.
|
data/RELEASE.md
CHANGED
data/lib/dsp/dsp_base.rb
CHANGED
data/lib/lsp/lsp_base.rb
CHANGED
|
@@ -54,7 +54,8 @@ module OpenVoxAgentRubygems
|
|
|
54
54
|
|
|
55
55
|
def self.packaged_agent_ruby?
|
|
56
56
|
[RbConfig::CONFIG['prefix'], Gem.default_dir].compact.any? do |path|
|
|
57
|
-
normalized_path(path)
|
|
57
|
+
normalized = normalized_path(path)
|
|
58
|
+
normalized.include?('/puppetlabs/puppet') || normalized.include?('/puppet labs/puppet')
|
|
58
59
|
end
|
|
59
60
|
end
|
|
60
61
|
private_class_method :packaged_agent_ruby?
|
data/lib/openvox_runtime.rb
CHANGED
|
@@ -8,7 +8,11 @@ module OpenVoxRuntime
|
|
|
8
8
|
def self.activate!(version = nil)
|
|
9
9
|
OpenVoxAgentRubygems.activate!
|
|
10
10
|
specification = select_specification(version)
|
|
11
|
-
|
|
11
|
+
if specification.nil?
|
|
12
|
+
message = "Unable to find the #{GEM_NAME} gem"
|
|
13
|
+
message << " version #{version}" unless version.nil?
|
|
14
|
+
raise Gem::LoadError, message
|
|
15
|
+
end
|
|
12
16
|
|
|
13
17
|
if Gem::Specification.find_all_by_name(GEM_NAME).include?(specification)
|
|
14
18
|
version.nil? || version.empty? ? gem(GEM_NAME) : gem(GEM_NAME, version)
|
|
@@ -29,7 +29,7 @@ module PuppetDebugServer
|
|
|
29
29
|
|
|
30
30
|
begin
|
|
31
31
|
# TODO: This could be slow on big files....
|
|
32
|
-
|
|
32
|
+
File.foreach(file_path, mode: 'rb', encoding: 'UTF-8').each_with_index do |item, index|
|
|
33
33
|
# index here zero-based whereas we want one-based indexing
|
|
34
34
|
file_contents[index + 1] = item if line_list.include?(index + 1)
|
|
35
35
|
end
|
|
@@ -133,7 +133,7 @@ module PuppetDebugServer
|
|
|
133
133
|
target_end_line = @debug_session.line_for_offset(target, target_loc.offset + target_loc.length)
|
|
134
134
|
|
|
135
135
|
# TODO: What about Hit and Conditional BreakPoints?
|
|
136
|
-
bp = line_breakpoints.find_index { |bp_line| bp_line
|
|
136
|
+
bp = line_breakpoints.find_index { |bp_line| bp_line.between?(target_start_line, target_end_line) }
|
|
137
137
|
unless bp.nil?
|
|
138
138
|
# Re-raise the hook as a breakpoint
|
|
139
139
|
@debug_session.execute_hook(:hook_breakpoint, [ast_classname, ''] + args)
|
|
@@ -247,7 +247,7 @@ module PuppetLanguageServer
|
|
|
247
247
|
return result if item_type.nil?
|
|
248
248
|
|
|
249
249
|
result.documentation = item_type.doc unless item_type.doc.nil?
|
|
250
|
-
unless item_type.nil? || item_type.signatures.
|
|
250
|
+
unless item_type.nil? || item_type.signatures.none?
|
|
251
251
|
result.detail = item_type.signatures.map(&:key).join("\n\n")
|
|
252
252
|
# The signature provider should handle suggestions after this, so just place the cursor ready for an opening bracket
|
|
253
253
|
result.insertText = data['name'].to_s
|
|
@@ -87,9 +87,10 @@ module PuppetLanguageServer
|
|
|
87
87
|
result
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
private
|
|
91
|
-
|
|
92
90
|
VALID_TOKEN_TYPES = %i[NAME STRING SSTRING].freeze
|
|
91
|
+
private_constant :VALID_TOKEN_TYPES
|
|
92
|
+
|
|
93
|
+
private
|
|
93
94
|
|
|
94
95
|
def find_token_by_location(tokens, line, character)
|
|
95
96
|
return nil if tokens.empty?
|
|
@@ -194,7 +194,7 @@ module PuppetLanguageServer
|
|
|
194
194
|
def self.get_puppet_class_content(item_class)
|
|
195
195
|
content = "**#{item_class.key}** Resource"
|
|
196
196
|
content += "\n\n#{item_class.doc}" unless item_class.doc.nil?
|
|
197
|
-
unless item_class.parameters.
|
|
197
|
+
unless item_class.parameters.none?
|
|
198
198
|
content += "\n\n---\n"
|
|
199
199
|
item_class.parameters.sort.each do |name, _param|
|
|
200
200
|
content += "* #{name}\n"
|
|
@@ -78,7 +78,7 @@ module PuppetLanguageServer
|
|
|
78
78
|
signature_number = func_info.signatures.find_index { |sig| sig.parameters.count >= func_arg_count }
|
|
79
79
|
|
|
80
80
|
# If we still don't know the signature number then assume it's the first one
|
|
81
|
-
signature_number = 0 if signature_number.nil? && func_info.signatures.
|
|
81
|
+
signature_number = 0 if signature_number.nil? && func_info.signatures.any?
|
|
82
82
|
|
|
83
83
|
response.activeSignature = signature_number unless signature_number.nil?
|
|
84
84
|
response.activeParameter = param_number
|
|
@@ -110,10 +110,10 @@ module PuppetLanguageServer
|
|
|
110
110
|
# Is the cursor on or beyond the closing bracket? then we are not in any parameters
|
|
111
111
|
return nil if char_offset >= function_offset + function_length
|
|
112
112
|
# Does the function even have arguments? then the cursor HAS to be in the first parameter
|
|
113
|
-
return 0 if function_ast_object.arguments.
|
|
113
|
+
return 0 if function_ast_object.arguments.none?
|
|
114
114
|
|
|
115
115
|
# Is the cursor within any of the function argument locations? if so, return the parameter number we're in
|
|
116
|
-
param_number = function_ast_object.arguments.find_index { |arg| char_offset
|
|
116
|
+
param_number = function_ast_object.arguments.find_index { |arg| char_offset.between?(arg.offset, arg.offset + arg.length) }
|
|
117
117
|
return param_number unless param_number.nil?
|
|
118
118
|
|
|
119
119
|
# So now we know the char_offset exists outside any of the locators. Check the extremities
|
|
@@ -143,7 +143,7 @@ module PuppetLanguageServer
|
|
|
143
143
|
private_class_method :resolver_cache
|
|
144
144
|
|
|
145
145
|
def self.document_error_to_diagnostic(document_uri, error)
|
|
146
|
-
if error.puppetfile_modules.
|
|
146
|
+
if error.puppetfile_modules.none?
|
|
147
147
|
return LSP::Diagnostic.new(
|
|
148
148
|
'severity' => LSP::DiagnosticSeverity::ERROR,
|
|
149
149
|
'range' => LSP.create_range(0, 0, 0, max_line_length),
|
|
@@ -149,17 +149,17 @@ module PuppetLanguageServer
|
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
# Workspace management
|
|
152
|
-
WORKSPACE_CACHE_TTL_SECONDS
|
|
152
|
+
WORKSPACE_CACHE_TTL_SECONDS = 60
|
|
153
153
|
def initialize_store(options = {})
|
|
154
154
|
@workspace_path = options[:workspace]
|
|
155
155
|
@workspace_info_cache = {
|
|
156
|
-
expires: Time.
|
|
156
|
+
expires: Time.now - 120
|
|
157
157
|
}
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
def expire_store_information
|
|
161
161
|
@doc_mutex.synchronize do
|
|
162
|
-
@workspace_info_cache[:expires] = Time.
|
|
162
|
+
@workspace_info_cache[:expires] = Time.now - 120
|
|
163
163
|
end
|
|
164
164
|
end
|
|
165
165
|
|
|
@@ -208,7 +208,7 @@ module PuppetLanguageServer
|
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
def store_details
|
|
211
|
-
return @workspace_info_cache unless @workspace_info_cache[:never_expires] || @workspace_info_cache[:expires] < Time.
|
|
211
|
+
return @workspace_info_cache unless @workspace_info_cache[:never_expires] || @workspace_info_cache[:expires] < Time.now
|
|
212
212
|
|
|
213
213
|
# TTL has expired, time to calculate the document store details
|
|
214
214
|
|
|
@@ -232,7 +232,7 @@ module PuppetLanguageServer
|
|
|
232
232
|
new_cache[:has_environmentconf] = file_exist?(File.join(root_path, 'environment.conf'))
|
|
233
233
|
end
|
|
234
234
|
end
|
|
235
|
-
new_cache[:expires] = Time.
|
|
235
|
+
new_cache[:expires] = Time.now + WORKSPACE_CACHE_TTL_SECONDS
|
|
236
236
|
|
|
237
237
|
@doc_mutex.synchronize do
|
|
238
238
|
@workspace_info_cache = new_cache
|
|
@@ -100,7 +100,7 @@ module PuppetLanguageServer
|
|
|
100
100
|
|
|
101
101
|
PuppetLanguageServer.log_message(:info, "Attempting to dynamically register the #{method} method with id #{id}")
|
|
102
102
|
|
|
103
|
-
if @registrations[method]
|
|
103
|
+
if @registrations[method]&.any? { |registration| registration[:state] == :pending }
|
|
104
104
|
# The protocol doesn't specify whether this is allowed and is probably per client specific. For the moment we will allow
|
|
105
105
|
# the registration to be sent but log a message that something may be wrong.
|
|
106
106
|
PuppetLanguageServer.log_message(:warn, "A dynamic registration/deregistration for the #{method} method is already in progress")
|
|
@@ -135,7 +135,7 @@ module PuppetLanguageServer
|
|
|
135
135
|
reg[:state] = :pending
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
-
if params.unregisterations.
|
|
138
|
+
if params.unregisterations.none?
|
|
139
139
|
PuppetLanguageServer.log_message(:debug, "Nothing to deregister for the #{method} method")
|
|
140
140
|
return true
|
|
141
141
|
end
|
|
@@ -17,7 +17,8 @@ module PuppetLanguageServer
|
|
|
17
17
|
include Base
|
|
18
18
|
|
|
19
19
|
def to_json(*options)
|
|
20
|
-
|
|
20
|
+
# JSON 2.21 requires an options hash, so expand the captured arguments instead of passing their array.
|
|
21
|
+
::JSON.generate(to_h, *options)
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def from_json!(json_string)
|
|
@@ -32,8 +33,11 @@ module PuppetLanguageServer
|
|
|
32
33
|
class BaseClass
|
|
33
34
|
include Base
|
|
34
35
|
|
|
36
|
+
IGNORED_INSTANCE_METHODS = %i[to_h to_json].freeze
|
|
37
|
+
|
|
35
38
|
def to_json(*options)
|
|
36
|
-
|
|
39
|
+
# JSON 2.21 requires an options hash, so expand the captured arguments instead of passing their array.
|
|
40
|
+
to_h.to_json(*options)
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
def from_json!(json_string)
|
|
@@ -46,7 +50,7 @@ module PuppetLanguageServer
|
|
|
46
50
|
self.class
|
|
47
51
|
.instance_methods(false)
|
|
48
52
|
.reject { |name| name.to_s.end_with?('=', '!') }
|
|
49
|
-
.reject { |name|
|
|
53
|
+
.reject { |name| IGNORED_INSTANCE_METHODS.include?(name) }
|
|
50
54
|
.each do |method_name|
|
|
51
55
|
return false unless send(method_name) == other.send(method_name)
|
|
52
56
|
end
|
|
@@ -59,7 +63,7 @@ module PuppetLanguageServer
|
|
|
59
63
|
self.class
|
|
60
64
|
.instance_methods(false)
|
|
61
65
|
.reject { |name| name.to_s.end_with?('=', '!') }
|
|
62
|
-
.reject { |name|
|
|
66
|
+
.reject { |name| IGNORED_INSTANCE_METHODS.include?(name) }
|
|
63
67
|
.each do |method_name|
|
|
64
68
|
return false unless send(method_name).eql?(other.send(method_name))
|
|
65
69
|
end
|
|
@@ -70,7 +74,7 @@ module PuppetLanguageServer
|
|
|
70
74
|
props = self.class
|
|
71
75
|
.instance_methods(false)
|
|
72
76
|
.reject { |name| name.to_s.end_with?('=', '!') }
|
|
73
|
-
.reject { |name|
|
|
77
|
+
.reject { |name| IGNORED_INSTANCE_METHODS.include?(name) }
|
|
74
78
|
.map do |method_name|
|
|
75
79
|
send(method_name).hash
|
|
76
80
|
end
|
|
@@ -120,7 +124,8 @@ module PuppetLanguageServer
|
|
|
120
124
|
include Base
|
|
121
125
|
|
|
122
126
|
def to_json(*options)
|
|
123
|
-
|
|
127
|
+
# JSON 2.21 requires an options hash, so expand the captured arguments instead of passing their array.
|
|
128
|
+
"[#{map { |item| item.to_json(*options) }.join(',')}]"
|
|
124
129
|
end
|
|
125
130
|
|
|
126
131
|
def from_json!(json_string)
|
|
@@ -141,11 +146,12 @@ module PuppetLanguageServer
|
|
|
141
146
|
attr_accessor :vertices, :edges, :error_content
|
|
142
147
|
|
|
143
148
|
def to_json(*options)
|
|
149
|
+
# JSON 2.21 requires an options hash, so expand the captured arguments instead of passing their array.
|
|
144
150
|
{
|
|
145
151
|
'vertices' => vertices,
|
|
146
152
|
'edges' => edges,
|
|
147
153
|
'error_content' => error_content
|
|
148
|
-
}.to_json(options)
|
|
154
|
+
}.to_json(*options)
|
|
149
155
|
end
|
|
150
156
|
|
|
151
157
|
def from_json!(json_string)
|
|
@@ -398,7 +404,8 @@ module PuppetLanguageServer
|
|
|
398
404
|
end
|
|
399
405
|
|
|
400
406
|
def to_json(*options)
|
|
401
|
-
|
|
407
|
+
# JSON 2.21 requires an options hash, so expand the captured arguments instead of passing their array.
|
|
408
|
+
to_h.to_json(*options)
|
|
402
409
|
end
|
|
403
410
|
|
|
404
411
|
def from_json!(json_string)
|
|
@@ -448,7 +455,8 @@ module PuppetLanguageServer
|
|
|
448
455
|
end
|
|
449
456
|
|
|
450
457
|
def to_json(*options)
|
|
451
|
-
|
|
458
|
+
# JSON 2.21 requires an options hash, so expand the captured arguments instead of passing their array.
|
|
459
|
+
@aggregate.to_json(*options)
|
|
452
460
|
end
|
|
453
461
|
|
|
454
462
|
def from_json!(json_string)
|
|
@@ -469,8 +477,6 @@ module PuppetLanguageServer
|
|
|
469
477
|
@aggregate.each(&block)
|
|
470
478
|
end
|
|
471
479
|
|
|
472
|
-
private
|
|
473
|
-
|
|
474
480
|
# When adding a new metadata item:
|
|
475
481
|
# - Add to the information to this hash
|
|
476
482
|
# - Add a method to access the aggregate
|
|
@@ -492,6 +498,9 @@ module PuppetLanguageServer
|
|
|
492
498
|
list_class: PuppetTypeList
|
|
493
499
|
}
|
|
494
500
|
}.freeze
|
|
501
|
+
private_constant :METADATA_LIST
|
|
502
|
+
|
|
503
|
+
private
|
|
495
504
|
|
|
496
505
|
def list_for_object_class(klass)
|
|
497
506
|
METADATA_LIST.each do |name, info|
|
|
@@ -13,8 +13,8 @@ module PuppetLanguageServerSidecar
|
|
|
13
13
|
|
|
14
14
|
@cache_dir = File.join(Dir.tmpdir, 'puppet-vscode-cache')
|
|
15
15
|
begin
|
|
16
|
-
|
|
17
|
-
rescue
|
|
16
|
+
FileUtils.mkdir_p(@cache_dir)
|
|
17
|
+
rescue SystemCallError => e
|
|
18
18
|
PuppetLanguageServerSidecar.log_message(:error, "[PuppetLanguageServerSidecar::Cache::FileSystem] An error occured while creating file cache. Disabling cache: #{e}")
|
|
19
19
|
@cache_dir = nil
|
|
20
20
|
end
|
|
@@ -12,6 +12,7 @@ module PuppetLanguageServerSidecar
|
|
|
12
12
|
# Object - While useful, typically only needed when extended the type system as opposed to general use
|
|
13
13
|
# TypeSet - While useful, typically only needed when extended the type system as opposed to general use
|
|
14
14
|
IGNORE_DATATYPE_NAMES = %w[TypeReference TypeAlias Object TypeSet ObjectTypeExten Iterable AbstractTimeData TypeWithContained].freeze
|
|
15
|
+
IGNORE_TYPE_NAMES = %w[whit component].freeze
|
|
15
16
|
|
|
16
17
|
# Resource Face
|
|
17
18
|
def self.get_puppet_resource(typename, title = nil)
|
|
@@ -107,7 +108,7 @@ module PuppetLanguageServerSidecar
|
|
|
107
108
|
next unless object_types.include?(:type)
|
|
108
109
|
|
|
109
110
|
file_doc.types.each do |item|
|
|
110
|
-
result.append!(item) unless
|
|
111
|
+
result.append!(item) unless IGNORE_TYPE_NAMES.include?(name)
|
|
111
112
|
finder.temp_file.unlink if item.key == 'file' && File.exist?(finder.temp_file.path) # Remove the temp_file.rb if it exists
|
|
112
113
|
end
|
|
113
114
|
end
|
|
@@ -163,9 +164,7 @@ module PuppetLanguageServerSidecar
|
|
|
163
164
|
# Path to the environment
|
|
164
165
|
@env_path = puppet_env.configuration.path_to_env
|
|
165
166
|
# Path to the puppet installation
|
|
166
|
-
@puppet_path = if puppet_env.loaders.nil? # No loaders have been created yet
|
|
167
|
-
nil
|
|
168
|
-
elsif puppet_env.loaders.puppet_system_loader.nil?
|
|
167
|
+
@puppet_path = if puppet_env.loaders.nil? || puppet_env.loaders.puppet_system_loader.nil? # No loaders have been created yet
|
|
169
168
|
nil
|
|
170
169
|
elsif puppet_env.loaders.puppet_system_loader.lib_root?
|
|
171
170
|
File.join(puppet_env.loaders.puppet_system_loader.path, '..')
|
|
@@ -260,7 +259,7 @@ module PuppetLanguageServerSidecar
|
|
|
260
259
|
def all_object_info
|
|
261
260
|
{
|
|
262
261
|
class: [
|
|
263
|
-
{ relative_dir: 'manifests',
|
|
262
|
+
{ relative_dir: 'manifests', glob: '/**/*.pp' } # Pretty much everything in most modules
|
|
264
263
|
],
|
|
265
264
|
datatype: [
|
|
266
265
|
{ relative_dir: 'lib/puppet/datatypes', glob: '/**/*.rb' }, # Custom Data Types
|
|
@@ -272,7 +271,7 @@ module PuppetLanguageServerSidecar
|
|
|
272
271
|
{ relative_dir: 'lib/puppet/parser/functions', glob: '/**/*.rb' } # Contains functions written in Ruby for the legacy Puppet::Parser::Functions API
|
|
273
272
|
],
|
|
274
273
|
type: [
|
|
275
|
-
{ relative_dir: 'lib/puppet/type',
|
|
274
|
+
{ relative_dir: 'lib/puppet/type', glob: '/{,file/}*.rb' } # Contains Puppet resource types. Resource types like `file` can live in subdirs, hence the glob
|
|
276
275
|
]
|
|
277
276
|
}
|
|
278
277
|
end
|
|
@@ -7,7 +7,7 @@ module PuppetLanguageServerSidecar
|
|
|
7
7
|
|
|
8
8
|
begin
|
|
9
9
|
node_graph = compile_to_pretty_relationship_graph(content)
|
|
10
|
-
if node_graph.vertices.
|
|
10
|
+
if node_graph.vertices.none?
|
|
11
11
|
result.set_error('There were no resources created in the node graph. Is there an include statement missing?')
|
|
12
12
|
return result
|
|
13
13
|
end
|
|
@@ -60,15 +60,15 @@ module PuppetLanguageServerSidecar
|
|
|
60
60
|
# Remove vertexes which just clutter the graph
|
|
61
61
|
|
|
62
62
|
# Remove all of the Puppet::Type::Whit nodes. This is an internal only class
|
|
63
|
-
list = graph.vertices.
|
|
63
|
+
list = graph.vertices.grep(Puppet::Type::Whit)
|
|
64
64
|
list.each { |node| graph.remove_vertex!(node) }
|
|
65
65
|
|
|
66
66
|
# Remove all of the Puppet::Type::Schedule nodes
|
|
67
|
-
list = graph.vertices.
|
|
67
|
+
list = graph.vertices.grep(Puppet::Type::Schedule)
|
|
68
68
|
list.each { |node| graph.remove_vertex!(node) }
|
|
69
69
|
|
|
70
70
|
# Remove all of the Puppet::Type::Filebucket nodes
|
|
71
|
-
list = graph.vertices.
|
|
71
|
+
list = graph.vertices.grep(Puppet::Type::Filebucket)
|
|
72
72
|
list.each { |node| graph.remove_vertex!(node) }
|
|
73
73
|
|
|
74
74
|
graph
|
|
@@ -370,7 +370,8 @@ module PuppetLanguageServerSidecar
|
|
|
370
370
|
end
|
|
371
371
|
|
|
372
372
|
def to_json(*options)
|
|
373
|
-
JSON.
|
|
373
|
+
# JSON 2.21 requires an options hash, so expand the captured arguments instead of passing their array.
|
|
374
|
+
JSON.generate(to_h, *options)
|
|
374
375
|
end
|
|
375
376
|
|
|
376
377
|
# Deserialisation
|
|
@@ -17,11 +17,11 @@ module PuppetLanguageServerSidecar
|
|
|
17
17
|
@root_path
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def self.has_module_metadata? # rubocop:disable Naming/
|
|
20
|
+
def self.has_module_metadata? # rubocop:disable Naming/PredicatePrefix
|
|
21
21
|
@has_module_metadata
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def self.has_environmentconf? # rubocop:disable Naming/
|
|
24
|
+
def self.has_environmentconf? # rubocop:disable Naming/PredicatePrefix
|
|
25
25
|
@has_environmentconf
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'io/wait'
|
|
3
4
|
require 'puppet_editor_services/logging'
|
|
4
5
|
require 'puppet_editor_services/server/base'
|
|
5
6
|
require 'puppet_editor_services/connection/stdio'
|
|
@@ -59,8 +60,7 @@ module PuppetEditorServices
|
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
def pipe_is_readable?(stream, timeout = 0.5)
|
|
62
|
-
|
|
63
|
-
read_ready && stream == read_ready[0][0]
|
|
63
|
+
!stream.wait_readable(timeout).nil?
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def read_from_pipe(pipe, timeout = 0.1, &)
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
require 'socket'
|
|
4
4
|
require 'openssl'
|
|
5
5
|
|
|
6
|
-
# frozen_string_literal: true
|
|
7
|
-
|
|
8
6
|
require 'puppet_editor_services/logging'
|
|
9
7
|
require 'puppet_editor_services/server/base'
|
|
10
8
|
require 'puppet_editor_services/connection/tcp'
|
|
@@ -340,9 +338,8 @@ module PuppetEditorServices
|
|
|
340
338
|
# @api private
|
|
341
339
|
def clear_connections
|
|
342
340
|
# Using a SymbolProc here does not work
|
|
343
|
-
# rubocop:disable Style/SymbolProc
|
|
341
|
+
# rubocop:disable-next Style/SymbolProc
|
|
344
342
|
self.class.c_locker.synchronize { self.class.io_connection_dic.delete_if { |c| c.closed? } }
|
|
345
|
-
# rubocop:enable Style/SymbolProc
|
|
346
343
|
end
|
|
347
344
|
end
|
|
348
345
|
end
|
|
@@ -165,6 +165,7 @@ module PuppetLanguageServer
|
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
opts.on('--enable-file-cache', '** DEPRECATED ** Enables the file system cache for Puppet Objects (types, class etc.)') do |_misc|
|
|
168
|
+
# This option is now deprecated and has no effect. The file system cache is always enabled.
|
|
168
169
|
end
|
|
169
170
|
|
|
170
171
|
# These options are normally passed through to the Sidecar
|
|
@@ -185,6 +186,7 @@ module PuppetLanguageServer
|
|
|
185
186
|
end
|
|
186
187
|
|
|
187
188
|
opts.on('--local-workspace=PATH', '** DEPRECATED ** The workspace or file path that will be used to provide module-specific functionality. Default is no workspace path.') do |_path|
|
|
189
|
+
# This option is now deprecated and has no effect. The workspace path is now determined by the client.
|
|
188
190
|
end
|
|
189
191
|
|
|
190
192
|
opts.on('-h', '--help', 'Prints this help') do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openvox-editor-services
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.
|
|
4
|
+
version: 3.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenVox Project contributors
|
|
@@ -46,7 +46,7 @@ dependencies:
|
|
|
46
46
|
version: '5.1'
|
|
47
47
|
- - "<"
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '
|
|
49
|
+
version: '7'
|
|
50
50
|
type: :runtime
|
|
51
51
|
prerelease: false
|
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -56,7 +56,7 @@ dependencies:
|
|
|
56
56
|
version: '5.1'
|
|
57
57
|
- - "<"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '
|
|
59
|
+
version: '7'
|
|
60
60
|
- !ruby/object:Gem::Dependency
|
|
61
61
|
name: openvox-strings
|
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
253
253
|
- !ruby/object:Gem::Version
|
|
254
254
|
version: '0'
|
|
255
255
|
requirements: []
|
|
256
|
-
rubygems_version: 4.0.
|
|
256
|
+
rubygems_version: 4.0.20
|
|
257
257
|
specification_version: 4
|
|
258
258
|
summary: OpenVox Puppet DSL Server for editors
|
|
259
259
|
test_files: []
|