Skip to content

Commit 427933d

Browse files
committed
(GH-46) Autoload modules, not just core types
Previously the puppet helper only loaded the core puppet types. This commit instead invokes the Puppet::Util::Autoload class to load all of the puppet types. This means that type loading is now slower, but as it has async support this won't stop UI requests for too long.
1 parent 6012d07 commit 427933d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/lib/puppet-languageserver/puppet_helper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,15 @@ def self.prune_resource_parameters(resources)
119119

120120
def self._load_types
121121
@types_hash = {}
122-
Puppet::Type.loadall
122+
# This is an expensive call
123+
# From https://github.com/puppetlabs/puppet/blob/ebd96213cab43bb2a8071b7ac0206c3ed0be8e58/lib/puppet/metatype/manager.rb#L182-L189
124+
typeloader = Puppet::Util::Autoload.new(self, "puppet/type")
125+
typeloader.loadall
123126

124127
Puppet::Type.eachtype do |type|
125128
next if type.name == :component
126129
next if type.name == :whit
130+
127131
@types_hash[type.name] = type
128132
end
129133

0 commit comments

Comments
 (0)