openvox-editor-services 3.1.2 → 4.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ced2731b011c871cca3b491fbc8d1a80a3145c5c734e4e6280d971d3d9bb16c
4
- data.tar.gz: 66bb67ee45ea6b0366f19f4b6fe02fea140a9cb52e76cd29cb3a4e6d8228842e
3
+ metadata.gz: bdea88fc71917e7a0813d0ede0cd6baa82770a416a998a68ee5a6e6e781fe88d
4
+ data.tar.gz: 6de1fb9e00fdfe2dc9824d13d40283c605ef2c79e62452df2b0a7614b4cba634
5
5
  SHA512:
6
- metadata.gz: 645deea766c6d0b2b03cf6fe8810d289e9afd19199698b5767e28c8b0ee3f390155132407b122b7c4528d83b130ed92bf1dc88b1aea923626f69668555a5100f
7
- data.tar.gz: d3e7069ad80724af6bfa7d743bdc3de1c27a82cb8ef8f0431cc8dd8b888a5f316957518a5c6d78856b6b8458551e197ac263652c4a2882cdd259e3050d8a3fc7
6
+ metadata.gz: cc271d47fb8bfbda55e0948dc08b3786818d14b5141b3fa85fe51fa76a55949ba4e964961296faee32c1276e8a97727765da76eb5888af5eda8faab9c8ae07b6
7
+ data.tar.gz: ceff85dbada907b81d0ee9f527e5af58cff47373048c8d8c6de16233968255b02bf74f90d1bb75339497f280d53e89fe65aeadefe5488aa2fa6dd7bde1592a21
data/CHANGELOG.md CHANGED
@@ -1,8 +1,24 @@
1
1
  # Changelog
2
2
 
3
- ## [3.1.2](https://github.com/voxpupuli/openvox-editor-services/tree/3.1.2) (2026-10-30)
3
+ ## [4.0.0](https://github.com/voxpupuli/openvox-editor-services/tree/4.0.0) (2026-11-06)
4
4
 
5
- [Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/v3.1.1...3.1.2)
5
+ [Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/v3.1.2...4.0.0)
6
+
7
+ **Breaking changes:**
8
+
9
+ - Use `openvox` namespace for settings [\#80](https://github.com/voxpupuli/openvox-editor-services/pull/80) ([jay7x](https://github.com/jay7x))
10
+
11
+ **Implemented enhancements:**
12
+
13
+ - honor client editor settings for formatting and folding [\#81](https://github.com/voxpupuli/openvox-editor-services/pull/81) ([jay7x](https://github.com/jay7x))
14
+
15
+ **Fixed bugs:**
16
+
17
+ - fix: prevent puppet-lint failures from crashing the language server [\#83](https://github.com/voxpupuli/openvox-editor-services/pull/83) ([jay7x](https://github.com/jay7x))
18
+
19
+ ## [v3.1.2](https://github.com/voxpupuli/openvox-editor-services/tree/v3.1.2) (2026-10-31)
20
+
21
+ [Full Changelog](https://github.com/voxpupuli/openvox-editor-services/compare/v3.1.1...v3.1.2)
6
22
 
7
23
  **Fixed bugs:**
8
24
 
@@ -115,6 +115,9 @@ module PuppetLanguageServer
115
115
  begin
116
116
  # When running async (i.e. from a thread swallow any output)
117
117
  _result = execute_job(work_item)
118
+ rescue SystemExit => e
119
+ PuppetLanguageServer.log_message(:error, "#{self.class} Thread: Job #{work_item.key} attempted to exit. #{e}")
120
+ nil
118
121
  rescue StandardError => e
119
122
  PuppetLanguageServer.log_message(:error, "#{self.class} Thread: Error running job #{work_item.key}. #{e}\n#{e.backtrace}")
120
123
  nil
@@ -18,10 +18,17 @@ module PuppetLanguageServer
18
18
  init_puppet_lint(session_state.documents.store_root_path, ['--fix', '--relative'])
19
19
 
20
20
  linter = PuppetLint::Checks.new
21
- problems = linter.run(lint_filename(document_uri), content)
21
+ lint_aborted = false
22
+ problems = begin
23
+ linter.run(lint_filename(document_uri), content)
24
+ rescue SystemExit
25
+ PuppetLanguageServer.log_message(:error, '(fix_validate_errors) puppet-lint aborted')
26
+ lint_aborted = true
27
+ nil
28
+ end
22
29
  problems_fixed = problems.nil? ? 0 : problems.count { |item| item[:kind] == :fixed }
23
30
 
24
- [problems_fixed, linter.manifest]
31
+ [problems_fixed, lint_aborted ? content : linter.manifest]
25
32
  end
26
33
 
27
34
  def self.validate(session_state, content, options = {})
@@ -38,7 +45,12 @@ module PuppetLanguageServer
38
45
 
39
46
  begin
40
47
  linter = PuppetLint::Checks.new
41
- problems = linter.run(lint_filename(options[:document_uri]), content)
48
+ problems = begin
49
+ linter.run(lint_filename(options[:document_uri]), content)
50
+ rescue SystemExit
51
+ PuppetLanguageServer.log_message(:error, '(textDocument/validation) puppet-lint aborted')
52
+ nil
53
+ end
42
54
  unless problems.nil?
43
55
  problems.each do |problem|
44
56
  # Syntax errors are better handled by the puppet parser, not puppet lint
@@ -178,7 +178,7 @@ module PuppetLanguageServer
178
178
  file_uri = json_rpc_message.params['textDocument']['uri']
179
179
  case documents.document_type(file_uri)
180
180
  when :manifest
181
- PuppetLanguageServer::Manifest::FoldingProvider.instance.folding_ranges(documents.document_tokens(file_uri))
181
+ PuppetLanguageServer::Manifest::FoldingProvider.instance.folding_ranges(documents.document_tokens(file_uri), language_client.folding_range_show_last_line)
182
182
  else
183
183
  raise "Unable to provide folding ranages on #{file_uri}"
184
184
  end
@@ -6,8 +6,13 @@ module PuppetLanguageServer
6
6
  line_offset = line_offsets[line_num]
7
7
  raise if line_offset.nil?
8
8
 
9
+ start_offset = line_offset + char_num
10
+ # Never remove more characters than exist before the removal point, as a
11
+ # negative slice length would return nil and break string concatenation.
12
+ num_chars_to_remove = num_chars_to_remove.clamp(0, start_offset)
13
+
9
14
  # Remove the offending character
10
- content.slice(0, line_offset + char_num - num_chars_to_remove) + content.slice(line_offset + char_num, content.length - num_chars_to_remove)
15
+ content.slice(0, start_offset - num_chars_to_remove) + content.slice(start_offset, content.length - num_chars_to_remove)
11
16
  end
12
17
 
13
18
  def self.remove_char_at(content, line_offsets, line_num, char_num)
@@ -86,15 +91,10 @@ module PuppetLanguageServer
86
91
  when :remove_word
87
92
  next if line_num.zero? && char_num.zero?
88
93
 
89
- next_char = get_char_at(content, line_offsets, line_num, char_num)
90
-
91
- while /[[:word:]]/ =~ next_char
92
- move_offset -= 1
93
- next_char = get_char_at(content, line_offsets, line_num, char_num + move_offset)
94
-
95
- break if char_num + move_offset < 0
96
- end
94
+ start_char = char_num
95
+ start_char -= 1 while start_char.positive? && /[[:word:]]/ =~ get_char_at(content, line_offsets, line_num, start_char)
97
96
 
97
+ move_offset = start_char - char_num
98
98
  new_content = remove_chars_starting_at(content, line_offsets, line_num, char_num, -move_offset)
99
99
  when :try_quotes
100
100
  # Perhaps try inserting double quotes. Useful in empty arrays or during variable assignment
@@ -8,8 +8,8 @@ module PuppetLanguageServer
8
8
  # Client settings
9
9
  attr_reader :format_on_type
10
10
 
11
- DEFAULT_FORMAT_ON_TYPE_ENABLE = false
12
- DEFAULT_FORMAT_ON_TYPE_FILESIZE_LIMIT = 4096
11
+ DEFAULT_FORMAT_ON_TYPE_ENABLE = true
12
+ DEFAULT_FORMAT_ON_TYPE_FILESIZE_LIMIT = 16_384
13
13
  DEFAULT_FOLDING_RANGE_ENABLE = true # Default is true as per VS Code
14
14
  DEFAULT_FOLDING_RANGE_SHOW_LAST_LINE = true # Default is true as per VS Code
15
15
  DEFAULT_VALIDATE_RESOLVE_PUPPETFILES = true
@@ -42,7 +42,7 @@ module PuppetLanguageServer
42
42
 
43
43
  def send_configuration_request
44
44
  params = LSP::ConfigurationParams.new.from_h!('items' => [])
45
- params.items << LSP::ConfigurationItem.new.from_h!('section' => 'puppet')
45
+ params.items << LSP::ConfigurationItem.new.from_h!('section' => 'openvox')
46
46
 
47
47
  message_handler.protocol.send_client_request('workspace/configuration', params)
48
48
  true
@@ -54,7 +54,7 @@ module PuppetLanguageServer
54
54
 
55
55
  def parse_lsp_configuration_settings!(settings = {})
56
56
  # format on type enabled
57
- value = to_boolean(safe_hash_traverse(settings, 'puppet', 'editorService', 'formatOnType', 'enable'), DEFAULT_FORMAT_ON_TYPE_ENABLE)
57
+ value = to_boolean(safe_hash_traverse(settings, 'openvox', 'editorService', 'formatOnType', 'enable'), DEFAULT_FORMAT_ON_TYPE_ENABLE)
58
58
  unless value == @format_on_type # Ummm no.
59
59
  # Is dynamic registration available?
60
60
  if client_capability('textDocument', 'onTypeFormatting', 'dynamicRegistration') == true
@@ -67,18 +67,18 @@ module PuppetLanguageServer
67
67
  @format_on_type = value
68
68
  end
69
69
  # format on type file size
70
- @format_on_type_filesize_limit = to_integer(safe_hash_traverse(settings, 'puppet', 'editorService', 'formatOnType', 'maxFileSize'), DEFAULT_FORMAT_ON_TYPE_FILESIZE_LIMIT, 0)
70
+ @format_on_type_filesize_limit = to_integer(safe_hash_traverse(settings, 'openvox', 'editorService', 'formatOnType', 'maxFileSize'), DEFAULT_FORMAT_ON_TYPE_FILESIZE_LIMIT, 0)
71
71
 
72
72
  # use puppetfile resolver
73
- @use_puppetfile_resolver = to_boolean(safe_hash_traverse(settings, 'puppet', 'validate', 'resolvePuppetfiles'), DEFAULT_VALIDATE_RESOLVE_PUPPETFILES)
73
+ @use_puppetfile_resolver = to_boolean(safe_hash_traverse(settings, 'openvox', 'validate', 'resolvePuppetfiles'), DEFAULT_VALIDATE_RESOLVE_PUPPETFILES)
74
74
 
75
75
  # folding range enabled
76
- value = to_boolean(safe_hash_traverse(settings, 'puppet', 'editorService', 'foldingRange', 'enable'), DEFAULT_FOLDING_RANGE_ENABLE) && PuppetLanguageServer::ServerCapabilites.folding_provider_supported?
76
+ value = to_boolean(safe_hash_traverse(settings, 'openvox', 'editorService', 'foldingRange', 'enable'), DEFAULT_FOLDING_RANGE_ENABLE) && PuppetLanguageServer::ServerCapabilites.folding_provider_supported?
77
77
  unless value == @folding_range # Ummm no.
78
78
  # Is dynamic registration available?
79
79
  if client_capability('textDocument', 'foldingRange', 'dynamicRegistration') == true
80
80
  if value
81
- register_capability('textDocument/foldingRange', PuppetLanguageServer::ServerCapabilites.document_on_type_formatting_options)
81
+ register_capability('textDocument/foldingRange', PuppetLanguageServer::ServerCapabilites.folding_range_provider_options)
82
82
  else
83
83
  unregister_capability('textDocument/foldingRange')
84
84
  end
@@ -86,7 +86,7 @@ module PuppetLanguageServer
86
86
  @folding_range = value
87
87
  end
88
88
  # folding range last line display
89
- @folding_range_show_last_line = to_boolean(safe_hash_traverse(settings, 'puppet', 'editorService', 'foldingRange', 'showLastLine'), DEFAULT_FOLDING_RANGE_SHOW_LAST_LINE)
89
+ @folding_range_show_last_line = to_boolean(safe_hash_traverse(settings, 'openvox', 'editorService', 'foldingRange', 'showLastLine'), DEFAULT_FOLDING_RANGE_SHOW_LAST_LINE)
90
90
  end
91
91
 
92
92
  def capability_registrations(method)
@@ -65,7 +65,7 @@ module PuppetEditorServices
65
65
  request_message, send(method_name, protocol.connection.id, request_message)
66
66
  )
67
67
  )
68
- rescue StandardError => e
68
+ rescue StandardError, SystemExit => e
69
69
  unhandled_exception(e, source: :request, message: request_message)
70
70
  end
71
71
  return true
@@ -87,7 +87,7 @@ module PuppetEditorServices
87
87
  if respond_to?(method_name.intern)
88
88
  begin
89
89
  send(method_name, protocol.connection.id, notification_message)
90
- rescue StandardError => e
90
+ rescue StandardError, SystemExit => e
91
91
  unhandled_exception(e, source: :notification, message: notification_message)
92
92
  end
93
93
  return true
@@ -114,7 +114,7 @@ module PuppetEditorServices
114
114
  if respond_to?(method_name.intern)
115
115
  begin
116
116
  send(method_name, protocol.connection.id, response_message, original_request)
117
- rescue StandardError => e
117
+ rescue StandardError, SystemExit => e
118
118
  unhandled_exception(e, source: :response, message: response_message)
119
119
  end
120
120
  return true
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetEditorServices
4
- PUPPETEDITORSERVICESVERSION = '3.1.2' unless defined? PUPPETEDITORSERVICESVERSION
4
+ PUPPETEDITORSERVICESVERSION = '4.0.0' unless defined? PUPPETEDITORSERVICESVERSION
5
5
 
6
6
  # @api public
7
7
  #
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.2
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenVox Project contributors