Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: The PowerShell extension terminal does not appear to evaluate PowerShell expressions. #3

Closed
3 tasks done
f0oster opened this issue Jul 31, 2024 · 7 comments
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@f0oster
Copy link

f0oster commented Jul 31, 2024

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.10.1

Operating system/version

MacOS 14.2.1

Describe the bug

The PowerShell extension terminal does not appear to evaluate PowerShell expressions.

Steps To Reproduce

  1. Toggle Powershell Extension Terminal using :lua require'powershell'.toggle_term()
  2. Eval the current line (ie: 10 + 10) using:lua require'powershell'.eval()
  3. Observe output in terminal window - expression / command is printed, but no execution is apparent.

Expected Behavior

Expected to see output of 20, however, I see the following:

                  =====> PowerShell Editor Services <=====

10 + 10
@f0oster f0oster added the bug Something isn't working label Jul 31, 2024
@TheLeoP
Copy link
Owner

TheLeoP commented Jul 31, 2024

Are you sure the Powershell LS has finished attaching to your buffer? It looks like it hasn't. What's the output from :=vim.lsp.get_clients({bufnr=0}) while on a powershell buffer?

@TheLeoP
Copy link
Owner

TheLeoP commented Jul 31, 2024

For the record, I see the following whille doing the same:



                  =====> PowerShell Editor Services <=====


PS /home/luis> 10+10
20

@f0oster
Copy link
Author

f0oster commented Jul 31, 2024

Output of :LspInfo:

 Language client log: /Users/f0oster/.local/state/nvim/lsp.log
 Detected filetype:   ps1
 
 1 client(s) attached to this buffer: 
 
 Client: powershell_es (id: 1, bufnr: [1])
 	filetypes:       ps1
 	autostart:       true
 	root directory:  /Users/f0oster/code/powershell/EnterpriseAppAuditing
 	cmd:             pwsh -NoLogo -NoProfile -Command & '/Users/f0oster/.local/share/nvim/mason/packages/powershell-editor-services/PowerShellEditorServices/Start-EditorServices.ps1' -BundledModulesPath '/Users/f0oster/.local/share/nvim/mason/packages/powershell-editor-services' -LogPath '/Users/f0oster/.cache/nvim/powershell_es.log' -SessionDetailsPath '/Users/f0oster/.cache/nvim/powershell_es.session.json' -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Normal
 
 Configured servers list: eslint, powershell_es, tsserver, rust_analyzer, clangd

Output of :=vim.lsp.get_clients({bufnr=0}):

{ {
    _log_prefix = "LSP[powershell_es]",
    _on_attach_cbs = { <function 1> },
    _on_exit_cbs = { <function 2>, <function 3> },
    _on_init_cbs = { <function 4> },
    _trace = "off",
    attached_buffers = { true },
    cancel_request = <function 5>,
    capabilities = <1>{
      general = {
        positionEncodings = { "utf-16" }
      },
      textDocument = {
        callHierarchy = {
          dynamicRegistration = false
        },
        codeAction = {
          codeActionLiteralSupport = {
            codeActionKind = {
              valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }
            }
          },
          dataSupport = true,
          dynamicRegistration = true,
          isPreferredSupport = true,
          resolveSupport = {
            properties = { "edit" }
          }
        },
        completion = {
          completionItem = {
            commitCharactersSupport = true,
            deprecatedSupport = true,
            documentationFormat = { "markdown", "plaintext" },
            insertReplaceSupport = true,
            insertTextModeSupport = {
              valueSet = { 1, 2 }
            },
            labelDetailsSupport = true,
            preselectSupport = true,
            resolveSupport = {
              properties = { "documentation", "detail", "additionalTextEdits", "sortText", "filterText", "insertText", "textEdit", "insertTextFormat", "insertTextMode" }
            },
            snippetSupport = true,
            tagSupport = {
              valueSet = { 1 }
            }
          },
          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 }
          },
          completionList = {
            itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }
          },
          contextSupport = true,
          dynamicRegistration = false,
          insertTextMode = 1
        },
        declaration = {
          linkSupport = true
        },
        definition = {
          dynamicRegistration = true,
          linkSupport = true
        },
        diagnostic = {
          dynamicRegistration = false
        },
        documentHighlight = {
          dynamicRegistration = false
        },
        documentSymbol = {
          dynamicRegistration = false,
          hierarchicalDocumentSymbolSupport = 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 }
          }
        },
        formatting = {
          dynamicRegistration = true
        },
        hover = {
          contentFormat = { "markdown", "plaintext" },
          dynamicRegistration = true
        },
        implementation = {
          linkSupport = true
        },
        inlayHint = {
          dynamicRegistration = true,
          resolveSupport = {
            properties = { "textEdits", "tooltip", "location", "command" }
          }
        },
        publishDiagnostics = {
          dataSupport = true,
          relatedInformation = true,
          tagSupport = {
            valueSet = { 1, 2 }
          }
        },
        rangeFormatting = {
          dynamicRegistration = true
        },
        references = {
          dynamicRegistration = false
        },
        rename = {
          dynamicRegistration = true,
          prepareSupport = true
        },
        semanticTokens = {
          augmentsSyntaxTokens = true,
          dynamicRegistration = false,
          formats = { "relative" },
          multilineTokenSupport = false,
          overlappingTokenSupport = true,
          requests = {
            full = {
              delta = true
            },
            range = false
          },
          serverCancelSupport = false,
          tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },
          tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }
        },
        signatureHelp = {
          dynamicRegistration = false,
          signatureInformation = {
            activeParameterSupport = true,
            documentationFormat = { "markdown", "plaintext" },
            parameterInformation = {
              labelOffsetSupport = true
            }
          }
        },
        synchronization = {
          didSave = true,
          dynamicRegistration = false,
          willSave = true,
          willSaveWaitUntil = true
        },
        typeDefinition = {
          linkSupport = true
        }
      },
      window = {
        showDocument = {
          support = true
        },
        showMessage = {
          messageActionItem = {
            additionalPropertiesSupport = false
          }
        },
        workDoneProgress = true
      },
      workspace = {
        applyEdit = true,
        configuration = true,
        didChangeConfiguration = {
          dynamicRegistration = false
        },
        didChangeWatchedFiles = {
          dynamicRegistration = true,
          relativePatternSupport = true
        },
        inlayHint = {
          refreshSupport = true
        },
        semanticTokens = {
          refreshSupport = true
        },
        symbol = {
          dynamicRegistration = false,
          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 }
          }
        },
        workspaceEdit = {
          resourceOperations = { "rename", "create", "delete" }
        },
        workspaceFolders = true
      }
    },
    commands = {},
    config = {
      _on_attach = <function 6>,
      autostart = true,
      bundle_path = "/Users/f0oster/.local/share/nvim/mason/packages/powershell-editor-services",
      capabilities = <table 1>,
      cmd = { "pwsh", "-NoLogo", "-NoProfile", "-Command", "& '/Users/f0oster/.local/share/nvim/mason/packages/powershell-editor-services/PowerShellEditorServices/Start-EditorServices.ps1' -BundledModulesPath '/Users/f0oster/.local/share/nvim/mason/packages/powershell-editor-services' -LogPath '/Users/f0oster/.cache/nvim/powershell_es.log' -SessionDetailsPath '/Users/f0oster/.cache/nvim/powershell_es.session.json' -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Normal" },
      cmd_cwd = "/Users/f0oster/code/powershell/EnterpriseAppAuditing",
      filetypes = { "ps1" },
      handlers = <2>{},
      init_options = vim.empty_dict(),
      log_level = 2,
      message_level = 2,
      name = "powershell_es",
      on_attach = <function 1>,
      on_exit = <function 2>,
      on_init = <function 4>,
      on_new_config = <function 7>,
      root_dir = "/Users/f0oster/code/powershell/EnterpriseAppAuditing",
      settings = <3>{
        powershell = {
          codeFormatting = {
            Preset = "OTBS"
          }
        }
      },
      shell = "pwsh",
      single_file_support = true,
      workspace_folders = <4>{ {
          name = "/Users/f0oster/code/powershell/EnterpriseAppAuditing",
          uri = "file:///Users/f0oster/code/powershell/EnterpriseAppAuditing"
        } },
      <metatable> = <5>{
        __tostring = <function 8>
      }
    },
    dynamic_capabilities = {
      capabilities = {
        ["textDocument/codeAction"] = { {
            id = "36a0917b-5e31-41e3-b5bd-7742c376da2d",
            method = "textDocument/codeAction",
            registerOptions = {
              codeActionKinds = { "quickfix" },
              documentSelector = { {
                  language = "powershell"
                }, {
                  language = "pwsh"
                }, {
                  language = "ps1"
                }, {
                  language = "psm1"
                }, {
                  language = "psd1"
                }, {
                  pattern = "**/*.ps*1"
                } },
              workDoneProgress = true
            }
          } },
        ["textDocument/definition"] = { {
            id = "16aea740-31ae-4940-bc00-bdd35b40da53",
            method = "textDocument/definition",
            registerOptions = {
              documentSelector = { {
                  language = "powershell"
                }, {
                  language = "pwsh"
                }, {
                  language = "ps1"
                }, {
                  language = "psm1"
                }, {
                  language = "psd1"
                }, {
                  pattern = "**/*.ps*1"
                } },
              workDoneProgress = true
            }
          } },
        ["textDocument/formatting"] = { {
            id = "d890caab-fede-4013-ac4c-797b881b5d5d",
            method = "textDocument/formatting",
            registerOptions = {
              documentSelector = { {
                  language = "powershell"
                }, {
                  language = "pwsh"
                }, {
                  language = "ps1"
                }, {
                  language = "psm1"
                }, {
                  language = "psd1"
                }, {
                  pattern = "**/*.ps*1"
                } },
              workDoneProgress = true
            }
          } },
        ["textDocument/hover"] = { {
            id = "d5bc579e-12cf-4114-bcea-e5ccbaa4786f",
            method = "textDocument/hover",
            registerOptions = {
              documentSelector = { {
                  language = "powershell"
                }, {
                  language = "pwsh"
                }, {
                  language = "ps1"
                }, {
                  language = "psm1"
                }, {
                  language = "psd1"
                }, {
                  pattern = "**/*.ps*1"
                } },
              workDoneProgress = true
            }
          } },
        ["textDocument/rangeFormatting"] = { {
            id = "d2d235e4-0449-4cba-8fc5-0cf072352318",
            method = "textDocument/rangeFormatting",
            registerOptions = {
              documentSelector = { {
                  language = "powershell"
                }, {
                  language = "pwsh"
                }, {
                  language = "ps1"
                }, {
                  language = "psm1"
                }, {
                  language = "psd1"
                }, {
                  pattern = "**/*.ps*1"
                } },
              workDoneProgress = true
            }
          } },
        ["workspace/didChangeWatchedFiles"] = { {
            id = "561dfacd-dfff-49c3-ae21-fd8364606eea",
            method = "workspace/didChangeWatchedFiles",
            registerOptions = {
              watchers = { {
                  globPattern = "**/*.{ps1,psm1}",
                  kind = 7
                } }
            }
          } }
      },
      client_id = 1,
      <metatable> = {
        __index = {
          get = <function 9>,
          match = <function 10>,
          new = <function 11>,
          register = <function 12>,
          supports = <function 13>,
          supports_registration = <function 14>,
          unregister = <function 15>
        }
      }
    },
    flags = {},
    get_language_id = <function 16>,
    handlers = <table 2>,
    id = 1,
    initialized = true,
    is_stopped = <function 17>,
    messages = {
      messages = {},
      name = "powershell_es",
      progress = {},
      status = {}
    },
    name = "powershell_es",
    notify = <function 18>,
    offset_encoding = "utf-16",
    on_attach = <function 19>,
    progress = {
      _idx_read = 0,
      _idx_write = 0,
      _items = {},
      _size = 51,
      pending = {},
      <metatable> = {
        __call = <function 20>,
        __index = {
          clear = <function 21>,
          peek = <function 22>,
          pop = <function 23>,
          push = <function 24>
        }
      }
    },
    request = <function 25>,
    request_sync = <function 26>,
    requests = {},
    root_dir = "/Users/f0oster/code/powershell/EnterpriseAppAuditing",
    rpc = {
      is_closing = <function 27>,
      notify = <function 28>,
      request = <function 29>,
      terminate = <function 30>
    },
    server_capabilities = {
      codeLensProvider = {
        resolveProvider = true
      },
      completionProvider = {
        resolveProvider = true,
        triggerCharacters = { ".", "-", ":", "\\", "$", " " }
      },
      documentHighlightProvider = vim.empty_dict(),
      documentSymbolProvider = vim.empty_dict(),
      experimental = vim.empty_dict(),
      foldingRangeProvider = vim.empty_dict(),
      referencesProvider = vim.empty_dict(),
      semanticTokensProvider = {
        full = {
          delta = true
        },
        legend = {
          tokenModifiers = { "documentation", "declaration", "definition", "static", "async", "abstract", "deprecated", "readonly", "modification", "defaultLibrary" },
          tokenTypes = { "comment", "keyword", "string", "number", "regexp", "operator", "namespace", "type", "struct", "class", "interface", "enum", "typeParameter", "function", "method", "property", "macro", "variable", "parameter", "label", "modifier", "event", "enumMember", "decorator" }
        },
        range = true
      },
      signatureHelpProvider = {
        triggerCharacters = { " " }
      },
      textDocumentSync = {
        change = 2,
        openClose = true,
        save = {
          includeText = true
        }
      },
      workspace = {
        fileOperations = vim.empty_dict(),
        workspaceFolders = {
          changeNotifications = true,
          supported = true
        }
      },
      workspaceSymbolProvider = vim.empty_dict()
    },
    settings = <table 3>,
    stop = <function 31>,
    supports_method = <function 32>,
    workspace_did_change_configuration = <function 33>,
    workspace_folders = <table 4>,
    <metatable> = <6>{
      __index = <table 6>,
      _add_workspace_folder = <function 34>,
      _cancel_request = <function 35>,
      _exec_cmd = <function 36>,
      _is_stopped = <function 37>,
      _notification = <function 38>,
      _notify = <function 39>,
      _on_attach = <function 40>,
      _on_error = <function 41>,
      _on_exit = <function 42>,
      _remove_workspace_folder = <function 43>,
      _request = <function 44>,
      _request_sync = <function 45>,
      _resolve_handler = <function 46>,
      _run_callbacks = <function 47>,
      _server_request = <function 48>,
      _stop = <function 49>,
      _supports_method = <function 50>,
      _text_document_did_open_handler = <function 51>,
      create = <function 52>,
      initialize = <function 53>,
      write_error = <function 54>
    }
  } }

@TheLeoP
Copy link
Owner

TheLeoP commented Jul 31, 2024

It looks like you are setting up the powershell LS using nvim-lspconfig. If you use powershell.nvim, the cmd used to start the LSP is a lua function, not a string

@f0oster
Copy link
Author

f0oster commented Jul 31, 2024

It looks like you are setting up the powershell LS using nvim-lspconfig. If you use powershell.nvim, the cmd used to start the LSP is a lua function, not a string

I see. So it's a configuration issue with my setup? In that case, I guess maybe it'd be best to close the issue.

I am using lsp-zero, and I installed the PowerShell LS via Mason. I'm fairly new to neovim and not really sure how to get things working with my current setup. Did you have any advice?

@TheLeoP
Copy link
Owner

TheLeoP commented Aug 1, 2024

Did you have any advice?

Link the repo with your neovim configuration and i can take a look

@TheLeoP TheLeoP closed this as completed Aug 1, 2024
@f0oster
Copy link
Author

f0oster commented Aug 1, 2024

If you don't mind having a quick look, my current config is below:
https://github.com/f0oster/nvim/tree/main

If the solution is something simple, I'd really appreciate your help.

My config was originally based off an earlier version of https://github.com/ThePrimeagen/init.lua (before he migrated from Packer), I've marginally changed / added some things, and probably made a mess of things somewhat.

It's grown a little out of date as I never managed to incorporate neovim into my daily workflow. I'm mostly working with PS at work, and losing the integrated terminal in VS Code was a huge annoyance with my workflow so neovim use at work didn't last.

I was using neovim for personal projects with rust and c, but my hobby/personal programming projects have been pretty dry for the last 12 months, so I haven't been using neovim much at all for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants