Skip to content

Commit da40bb8

Browse files
committed
Fix completion provider with Puppet 5.2.0
Puppet issue 7668 (https://tickets.puppetlabs.com/browse/PUP-7668) was fixed in the puppet gem 5.2.0, which then caused parsing to work correctly. However this meant that root document checks were returning a BlockExpression object instead of nil. This commit changes the parsing so that the BlockExpression class as it is a container for other objects and can not be auto-completed in of itself. This commit also adds testing of Puppet gem 5.1.0 as this version of Puppe does not contain the PUP-7668 fix and we must ensure that all puppet versions have the same autocomplete behaviour.
1 parent f6449ae commit da40bb8

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

appveyor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ environment:
1818
- PUPPET_GEM_VERSION: "~> 5.0"
1919
RUBY_VER: 24-x64
2020
RAKE_TASK: test
21+
# Specific Puppet version testing
22+
- PUPPET_GEM_VERSION: "5.1.0"
23+
RUBY_VER: 24-x64
24+
RAKE_TASK: test
2125

2226
# Ruby style
2327
- PUPPET_GEM_VERSION: "~> 4.0"

server/lib/puppet-languageserver/completion_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def self.complete(content, line_num, char_num)
44
items = []
55
incomplete = false
66

7-
result = PuppetLanguageServer::PuppetParserHelper.object_under_cursor(content, line_num, char_num, true, [Puppet::Pops::Model::QualifiedName])
7+
result = PuppetLanguageServer::PuppetParserHelper.object_under_cursor(content, line_num, char_num, true, [Puppet::Pops::Model::QualifiedName, Puppet::Pops::Model::BlockExpression])
88

99
if result.nil?
1010
# We are in the root of the document.

server/lib/puppet-languageserver/hover_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module PuppetLanguageServer
22
module HoverProvider
33
def self.resolve(content, line_num, char_num)
4-
result = PuppetLanguageServer::PuppetParserHelper.object_under_cursor(content, line_num, char_num, false, [Puppet::Pops::Model::QualifiedName])
4+
result = PuppetLanguageServer::PuppetParserHelper.object_under_cursor(content, line_num, char_num, false, [Puppet::Pops::Model::QualifiedName, Puppet::Pops::Model::BlockExpression])
55
return LanguageServer::Hover.create_nil_response if result.nil?
66

77
path = result[:path]

0 commit comments

Comments
 (0)