puppetlabs / puppet-editor-services

Puppet Language Server for editors
Apache License 2.0
45 stars 21 forks source link

Language provider fails with spaces in path #277

Open iainhallam opened 3 years ago

iainhallam commented 3 years ago

What Versions are you running?

OS Version: Windows 10 Pro version 1909 build 18363.1016 VSCode Version: 1.48.2 (user setup) Puppet Extension Version: 0.28.0 PDK Version: 1.18.1

What You Are Seeing?

When editing files in repos with spaces in the path, the laguage server fails with the following error in Puppet output:

#<Thread:0x000000000682e578@c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:38 run> terminated with exception (report_on_exception is true):
c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/manifest/validation_provider.rb:48:in `chdir': Invalid argument @ dir_chdir - 'd:\Dropbox\Projects\Systems\puppet control' (Errno::EINVAL)
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/manifest/validation_provider.rb:48:in `validate'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:100:in `validate'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:137:in `block in worker'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:116:in `loop'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:116:in `worker'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:40:in `block in enqueue'

This causes linting to fail, so no code problems are shown for the workspace in Puppet files, while they are shown for other types of file.

Additionally, hovering over Puppet code whether there are spaces in the path or not, gives the following error in Log (Extension Host):

[2020-09-10 15:58:46.541] [exthost] [error] TypeError: Cannot read property 'kind' of null
    at asHoverContent (c:\Users\Iain\.vscode\extensions\puppet.puppet-vscode-0.28.0\node_modules\vscode-languageclient\lib\protocolConverter.js:101:27)
    at asHover (c:\Users\Iain\.vscode\extensions\puppet.puppet-vscode-0.28.0\node_modules\vscode-languageclient\lib\protocolConverter.js:134:31)

I think this may be a diversion from the main issue, though, as these hover errors are shown whether the language server fails or not.

What is Expected?

The language server should cope with spaces in the path to the files.

How Did You Get This To Happen? (Steps to Reproduce)

Tried with multiple repos, and a new module from PDK:

  1. pdk new module test_module
  2. Right-click in test_module folder, Open with Code.
  3. Create file manifests/init.pp with the content class test_module {} - Problems shows 1 warning, "class not documented".
  4. Close VS Code.
  5. Rename the folder from test_module to test module, Open with Code again.
  6. Open init.pp - no problems are shown. Ctrl-Shift-U and switch to Puppet - shows the EINVAL error.

I verified this with test paths:

I've uninstalled VS Code, and reinstalled it for my user, and uninstalled puppet-vscode (and deleted the puppet-vscode folder from extensions) then reinstalled that. No change.

Output Log

Puppet Output pane:

DEBUG: 2020-09-10T15:05:55.491Z Installation type has changed from auto to pdk
DEBUG: 2020-09-10T15:05:55.493Z Registered extension.pdkNewModule command
DEBUG: 2020-09-10T15:05:55.493Z Registered extension.pdkValidate command
DEBUG: 2020-09-10T15:05:55.493Z Registered extension.pdkTestUnit command
DEBUG: 2020-09-10T15:05:55.493Z Registered extension.pdkNewClass command
DEBUG: 2020-09-10T15:05:55.493Z Registered extension.pdkNewTask command
DEBUG: 2020-09-10T15:05:55.493Z Registered extension.pdkNewDefinedType command
DEBUG: 2020-09-10T15:05:55.494Z Found a valid Puppet installation at C:\Program Files\Puppet Labs\DevelopmentKit\puppet
DEBUG: 2020-09-10T15:05:55.494Z Setting status bar to Initializing
DEBUG: 2020-09-10T15:05:55.495Z Configuring language client options
DEBUG: 2020-09-10T15:05:55.495Z Creating server options
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Using environment variable DEVKIT_BASEDIR=C:\Program Files\Puppet Labs\DevelopmentKit
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Using environment variable GEM_HOME=C:\Program Files\Puppet Labs\DevelopmentKit\share\cache\ruby\2.5.0
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Using environment variable GEM_PATH=C:\Program Files\Puppet Labs\DevelopmentKit\private\ruby\2.5.8\lib\ruby\gems\2.5.0;C:\Program Files\Puppet Labs\DevelopmentKit\share\cache\ruby\2.5.0;C:\Program Files\Puppet Labs\DevelopmentKit\private\puppet\ruby\2.5.0
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Using environment variable RUBY_DIR=C:\Program Files\Puppet Labs\DevelopmentKit\private\ruby\2.5.8
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Using environment variable RUBYLIB=C:/Program Files/Puppet Labs/DevelopmentKit/lib;
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Using environment variable PATH=C:\Program Files\Puppet Labs\DevelopmentKit\bin;C:\Program Files\Puppet Labs\DevelopmentKit\private\ruby\2.5.8\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\php\7.4;C:\ProgramData\ComposerSetup\bin;C:\Program Files (x86)\Vagrant\bin;C:\Program Files (x86)\Common Files\Propellerhead Software\ReWire\;C:\Program Files\Common Files\Propellerhead Software\ReWire\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Users\Iain\AppData\Local\Microsoft\WindowsApps;C:\Users\Iain\AppData\Roaming\Composer\vendor\bin;C:\Users\Iain\AppData\Roaming\npm;C:\Users\Iain\AppData\Local\Programs\Microsoft VS Code\bin
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Using environment variable RUBYOPT=rubygems
DEBUG: 2020-09-10T15:05:55.496Z [getRubyEnvFromPDK] Editor Services will invoke with: C:\Program Files\Puppet Labs\DevelopmentKit\private\ruby\2.5.8\bin\ruby c:\Users\Iain\.vscode\extensions\puppet.puppet-vscode-0.28.0\vendor\languageserver\puppet-languageserver --stdio --timeout=10 --local-workspace='d:\test module' --debug=D:\Puppet-log.txt
DEBUG: 2020-09-10T15:05:55.496Z Creating language client
DEBUG: 2020-09-10T15:05:55.501Z Setting status bar to Initialization Complete
DEBUG: 2020-09-10T15:05:55.501Z Configuring Local::stdio connection handler
DEBUG: 2020-09-10T15:05:55.501Z Setting status bar to Starting languageserver
DEBUG: 2020-09-10T15:05:55.502Z Registered Format Document provider
DEBUG: 2020-09-10T15:05:55.503Z Registered command for node graph event handler
DEBUG: 2020-09-10T15:05:55.503Z Registered onDidSaveTextDocument for node graph event handler
DEBUG: 2020-09-10T15:05:55.503Z Registered DebugAdapterDescriptorFactory for Puppet
DEBUG: 2020-09-10T15:05:55.503Z Registered DebugConfigurationProvider for Puppet
DEBUG: 2020-09-10T15:05:56.494Z pdk shell started, pid: 49892
DEBUG: 2020-09-10T15:06:32.592Z Setting status bar to Loading Puppet
#<Thread:0x0000000006ae07a8@c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:38 run> terminated with exception (report_on_exception is true):
c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/manifest/validation_provider.rb:48:in `chdir': Invalid argument @ dir_chdir - 'd:\test module' (Errno::EINVAL)
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/manifest/validation_provider.rb:48:in `validate'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:100:in `validate'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:137:in `block in worker'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:116:in `loop'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:116:in `worker'
    from c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/validation_queue.rb:40:in `block in enqueue'
DEBUG: 2020-09-10T15:06:34.700Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:35.349Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:36.229Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:36.847Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:37.735Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:38.852Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:39.777Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:40.865Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:41.756Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:42.859Z Setting status bar to 6.17.0
DEBUG: 2020-09-10T15:06:43.914Z Setting status bar to 6.17.0

Debug log:

I, [2020-09-10T16:05:57.804569 #11888]  INFO -- : Language Server is v0.26.1
D, [2020-09-10T16:05:58.137558 #11888] DEBUG -- : Loading gems...
I, [2020-09-10T16:06:31.204211 #11888]  INFO -- : Using Puppet v6.17.0
D, [2020-09-10T16:06:31.529368 #11888] DEBUG -- : Detected additional puppet settings []
I, [2020-09-10T16:06:31.807751 #11888]  INFO -- : Initializing Puppet Helper...
D, [2020-09-10T16:06:31.863490 #11888] DEBUG -- : Initializing Document Store...
I, [2020-09-10T16:06:31.917256 #11888]  INFO -- : Initializing settings...
I, [2020-09-10T16:06:31.981634 #11888]  INFO -- : Starting RPC Server...
I, [2020-09-10T16:06:31.992845 #11888]  INFO -- : Using Facter v4.0.30
D, [2020-09-10T16:06:32.046823 #11888] DEBUG -- : Using STDIO Server
I, [2020-09-10T16:06:32.085747 #11888]  INFO -- : Preloading Puppet Types (Async)...
D, [2020-09-10T16:06:32.160581 #11888] DEBUG -- : STDIOSRV: Starting STDIO server...
I, [2020-09-10T16:06:32.167457 #11888]  INFO -- : Preloading Facter (Async)...
D, [2020-09-10T16:06:32.213306 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":41072,"rootPath":"d:\\test module","rootUri":"file:///d%3A/test%20module","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true}}},"trace":"off","workspaceFolders":[{"uri":"file:///d%3A/test%20module","name":"test module"}]}}
---
D, [2020-09-10T16:06:32.212293 #11888] DEBUG -- : SidecarQueue Thread: Running sidecar ["ruby", "c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/puppet-languageserver-sidecar", "--action", "default_types", "--puppet-version=6.17.0"]
I, [2020-09-10T16:06:32.256637 #11888]  INFO -- : Preloading Functions (Async)...
D, [2020-09-10T16:06:32.290291 #11888] DEBUG -- : SidecarQueue Thread: Running sidecar ["ruby", "c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/puppet-languageserver-sidecar", "--action", "facts", "--puppet-version=6.17.0"]
D, [2020-09-10T16:06:32.291502 #11888] DEBUG -- : Received initialize method
I, [2020-09-10T16:06:32.356801 #11888]  INFO -- : Preloading Classes (Async)...
D, [2020-09-10T16:06:32.473478 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":1,"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":[">","$","[","="]},"definitionProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]}}}}
---
I, [2020-09-10T16:06:32.545732 #11888]  INFO -- : Preloading DataTypes (Async)...
D, [2020-09-10T16:06:32.602329 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","method":"initialized","params":{}}
---
I, [2020-09-10T16:06:32.697291 #11888]  INFO -- : Preloading static data (Async)...
I, [2020-09-10T16:06:32.800807 #11888]  INFO -- : Client has received initialization
D, [2020-09-10T16:06:33.029952 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-aggregate.json...
I, [2020-09-10T16:06:33.084471 #11888]  INFO -- : Attempting to dynamically register the workspace/didChangeConfiguration method with id fc95383a-9859-45db-9aff-2036880df77c
D, [2020-09-10T16:06:33.115577 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-boltlib.json...
D, [2020-09-10T16:06:33.196158 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":0,"method":"client/registerCapability","params":{"registrations":[{"id":"fc95383a-9859-45db-9aff-2036880df77c","registerOptions":{},"method":"workspace/didChangeConfiguration"}]}}
---
D, [2020-09-10T16:06:33.369639 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-canary.json...
D, [2020-09-10T16:06:33.394988 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///d%3A/test%20module/manifests/init.pp","languageId":"puppet","version":1,"text":"class test_module {}\r\n"}}}
---
D, [2020-09-10T16:06:33.502206 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-ctrl.json...
I, [2020-09-10T16:06:33.566080 #11888]  INFO -- : Received textDocument/didOpen notification.
D, [2020-09-10T16:06:33.616228 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-file.json...
D, [2020-09-10T16:06:33.681724 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":1,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///d%3A/test%20module/manifests/init.pp"}}}
---
E, [2020-09-10T16:06:33.776223 #11888] ERROR -- : Error in ValidationQueue Thread: Invalid argument @ dir_chdir - 'd:\test module'
D, [2020-09-10T16:06:33.854509 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-out.json...
D, [2020-09-10T16:06:33.913264 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":1,"result":[{"children":[],"detail":"test_module","kind":5,"selectionRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":20}},"name":"test_module","range":{"start":{"line":0,"character":0},"end":{"line":0,"character":20}}}]}
---
D, [2020-09-10T16:06:34.103175 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-puppetdb_fact.json...
D, [2020-09-10T16:06:34.109593 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":0,"result":null}
---
D, [2020-09-10T16:06:34.133781 #11888] DEBUG -- : Importing static data file c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/lib/puppet-languageserver/static_data/bolt-system.json...
I, [2020-09-10T16:06:34.181320 #11888]  INFO -- : Succesfully dynamically registered the workspace/didChangeConfiguration method
D, [2020-09-10T16:06:34.224080 #11888] DEBUG -- : Static bolt data returned 40 functions
D, [2020-09-10T16:06:34.269332 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"section":"puppet"}]}}
---
D, [2020-09-10T16:06:34.351215 #11888] DEBUG -- : Static bolt data returned 6 datatypes
D, [2020-09-10T16:06:34.582336 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":2,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:34.638630 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":2,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:34.702755 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":1,"result":[{"editorService":{"enable":true,"debugFilePath":"D:\\Puppet-log.txt","featureFlags":[],"formatOnType":{"enable":false},"hover":{"showMetadataInfo":true},"loglevel":"debug","protocol":"stdio","puppet":{"confdir":"","environment":"","modulePath":"","vardir":"","version":""},"tcp":{"address":"","port":0},"timeout":10},"validate":{"resolvePuppetfiles":true},"format":{"enable":true},"installDirectory":"","installType":"auto","notification":{"nodeGraph":"messagebox","puppetResource":"messagebox"},"pdk":{"checkVersion":true},"titleBar":{"pdkNewModule":{"enable":true}}}]}
---
D, [2020-09-10T16:06:34.767567 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":3,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:34.999247 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":3,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:35.977726 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":4,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:36.171617 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":4,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:36.617840 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":5,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:36.736124 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":5,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:37.617415 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":6,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:37.687029 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":6,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:38.710847 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":7,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:38.811560 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":7,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:39.636293 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":8,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:39.718949 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":8,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:40.654498 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":9,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:40.805455 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":9,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:41.637690 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":10,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:41.705282 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":10,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:42.701315 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":11,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:42.799840 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":11,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:43.716182 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":12,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:43.858799 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":12,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:44.764662 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":13,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:45.007623 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":13,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:45.774250 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":14,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:45.911239 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":14,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:47.133749 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":15,"method":"puppet/getVersion","params":null}
---
D, [2020-09-10T16:06:47.390336 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":15,"result":{"typesLoaded":false,"classesLoaded":false,"puppetVersion":"6.17.0","facterVersion":"4.0.30","languageServerVersion":"0.26.1","factsLoaded":false,"functionsLoaded":false}}
---
D, [2020-09-10T16:06:47.545675 #11888] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":16,"method":"shutdown","params":null}
---
D, [2020-09-10T16:06:47.787561 #11888] DEBUG -- : Received shutdown method
D, [2020-09-10T16:06:47.924169 #11888] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":16,"result":null}
---
A, [2020-09-10T16:07:01.976453 #11888]   ANY -- : SidecarQueue Thread: Calling sidecar with --action default_types --puppet-version=6.17.0 returned exitcode 0, 
D, [2020-09-10T16:07:02.087526 #11888] DEBUG -- : SidecarQueue Thread: default_types returned 12 items
D, [2020-09-10T16:07:02.125725 #11888] DEBUG -- : SidecarQueue Thread: Running sidecar ["ruby", "c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/puppet-languageserver-sidecar", "--action", "default_functions", "--puppet-version=6.17.0"]
A, [2020-09-10T16:07:02.445712 #11888]   ANY -- : SidecarQueue Thread: Calling sidecar with --action facts --puppet-version=6.17.0 returned exitcode 0, 
D, [2020-09-10T16:07:02.485778 #11888] DEBUG -- : SidecarQueue Thread: facts returned 84 items
D, [2020-09-10T16:07:02.525712 #11888] DEBUG -- : SidecarQueue Thread: Running sidecar ["ruby", "c:/Users/Iain/.vscode/extensions/puppet.puppet-vscode-0.28.0/vendor/languageserver/puppet-languageserver-sidecar", "--action", "default_classes", "--puppet-version=6.17.0"]
jpogran commented 3 years ago

Thank you for the detailed report @iainhallam! I agree that the language server should be able to handle spaces in paths, so we will investigate where in the manifest validator that is breaking.

In general I advise to not use spaces in Puppet module folder names or Puppet control repos going forward. Its against style guidelines for Puppet modules and is invalid when publishing to the forge, and I believe its against conventions with control repos. It will cause problems with other tooling than the VS Code extension, so it's best to adjust when you can rather than later.

iainhallam commented 3 years ago

Agree with the spaces in names thing, I was trying to reduce the issue to the barest minimum to reproduce it. I don't put spaces in names inside the control repo anywhere, or in my modules, but I do think that it's likely that people check out their repo, as I do, on a variety of machines where the path outside the control repo might have spaces in. That's what originally triggered my finding the issue here.

glennsarti commented 3 years ago

Yeah, this is an underlying Ruby error with chdir e.g https://tickets.puppetlabs.com/browse/PUP-6035. I wonder if I need to use an FFI call instead.