Skip to content

Commit c22e64d

Browse files
committed
(GH-98) Fix puppet initialization in Language Server
Previously the init_puppet_worker was loading the function environment twice which caused the Language Server to start slowly. This commit removes the unneeded loading. This commit also adds the ability to send Puppet Settings on initialization. This will only be used for test purposes and is not surfaced throught the CLI options.
1 parent ad09d1b commit c22e64d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

server/lib/puppet-languageserver.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,7 @@ def self.init_puppet(options)
118118
end
119119

120120
def self.init_puppet_worker(options)
121-
Puppet.initialize_settings
122-
123-
log_message(:info, 'Creating puppet function environment...')
124-
autoloader = Puppet::Parser::Functions.autoloader
125-
autoloader.loadall
121+
options[:puppet_settings].nil? ? Puppet.initialize_settings : Puppet.initialize_settings(options[:puppet_settings])
126122

127123
log_message(:info, "Using Facter v#{Facter.version}")
128124
if options[:preload_puppet]

0 commit comments

Comments
 (0)