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

How to run ? #1057

Closed
AmjadHD opened this issue Oct 4, 2019 · 22 comments · Fixed by #1059

Comments

@AmjadHD
Copy link

@AmjadHD AmjadHD commented Oct 4, 2019

I want to run this language server using sublime text using it's LSP client, what's the command to run it ?

@msftbot msftbot bot added the Needs: Triage 🔍 label Oct 4, 2019
@rjmholt

This comment has been minimized.

Copy link
Member

@rjmholt rjmholt commented Oct 4, 2019

@corbob

This comment has been minimized.

Copy link
Contributor

@corbob corbob commented Oct 4, 2019

Another reference you could use: coc-powershell uses this code

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 4, 2019

sorry I'm a noob in powershell, I couldn't find the correct command, here's my try:

			[
				"pwsh",
				"-ExecutionPolicy",
				"Bypass",
				"-NoProfile",
				"-NonInteractive",
				"D:/Amjad/PowerShellEditorServices/module/PowerShellEditorServices/Start-EditorServices.ps1",
				"-HostName",
				"coc.vim",
				"-HostProfileId",
				"coc.vim",
				"-HostVersion",
				"2.0.0",
				"-LogPath",
				"D:/Amjad/log.txt",
				"-LogLevel",
				"Normal",
				"-BundledModulesPath",
				"D:\\Amjad\\PowerShellEditorServices/module",
				"-EnableConsoleRepl",
				"-SessionDetailsPath",
				"D:/Amjad/session"
			],

this is the error

PowerShell Integrated Console



An error occurred while starting PowerShell Editor Services:

The argument is null. Provide a valid value for the argument, and then try running the command again.
   at System.Management.Automation.ValidateNotNullAttribute.Validate(Object arguments, EngineIntrinsics engineIntrinsics)
   at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)

and keeps running

@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 4, 2019

@AmjadHD give this a go:

https://github.com/PowerShell/PowerShellEditorServices/blob/master/test/PowerShellEditorServices.Test.E2E/TestsFixture.cs#L61-L71

[
"pwsh",
"-NoLogo",
"-NoProfile",
"-Command",
"path/to/downloaded/PowerShellEditorServices/PowerShellEditorSerivces/Start-EditorServices.ps1 -LogPath any/path/pses.log -LogLevel Normal -SessionDetailsPath any/path/session.json -FeatureFlags @() -HostName 'Sublime Text' -HostProfileId subl -HostVersion 1.0.0 -AdditionalModules @() -BundledModulesPath path/to/downloaded/PowerShellEditorServices -Stdio"
]

Notice that the last one is a bunch of parameters together, that's because it's actually the contents of the -Command parameter of pwsh.

You will have to fill in the path/to/downloaded/PowerShellEditorServices and for the SessionDetailsPath and the LogPath you can use anything as those will get created by PSES.

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 4, 2019

Thanks @TylerLeonhardt, now it's working, but there are no docstrings, nor go to definition, am I missing something ?

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 4, 2019

what are FeatureFlags and AdditionalModules ?

@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 4, 2019

Thanks @TylerLeonhardt, now it's working, but there are no docstrings, nor go to definition, am I missing something ?

Not sure from this side. You may have to work with the sublime folks. is intellisense working properly?

Can you share the logs here?

what are FeatureFlags and AdditionalModules ?

Additional stuff. You don't have any. That doesn't have anything to do with "go to definition" and the likes. Ex. there's a PowerShellEditorService.VSCode module that adds extra features specific to VSCode but that's separate from the LSP stuff. Also, there's only 1 feature flag "PSReadLine" which would only be used if you're using the Integrated Console which you're not because you're using stdio.

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 5, 2019

the log file

2019-10-05 00:09:52.081 +01:00 [INF] 
PowerShell Editor Services Host v2.0.0.0 starting (PID 6568)

  Host application details:

    Name:      Sublime Text
    Version:   1.0.0
    ProfileId: subl
    Arch:      X64

  Operating system details:

    Version: Microsoft Windows 10.0.17763 
    Arch:    X64

  Build information:

    Version: <development-build>
    Origin:  <development>
    Date:    2019-10-04T09:32:32

2019-10-05 00:09:52.139 +01:00 [INF] LSP NamedPipe: 
LSP OutPipe: 
2019-10-05 00:09:52.140 +01:00 [INF] Starting language server
2019-10-05 00:09:52.141 +01:00 [INF] Language service started, type = Stdio, endpoint =  InOut pipe: 
2019-10-05 00:09:53.302 +01:00 [INF] Adding handlers
2019-10-05 00:09:53.304 +01:00 [INF] Handlers added
2019-10-05 00:09:54.105 +01:00 [INF] PowerShell runtime version: 6.2.3, edition: Core
2019-10-05 00:09:55.896 +01:00 [INF] highlight handler loaded
2019-10-05 00:09:56.100 +01:00 [ERR] Execution of the following command(s) completed with errors:

    Import-Module D:\Amjad\PowerShellEditorServices\module\PowerShellEditorServices\bin\..\Commands\PowerShellEditorServices.Commands.psd1


here's the LSP client's log:

LSP: window 2 requests powershell-ls for D:\Amjad\PowerShellEditorServices\module\PowerShellEditorServices\Start-EditorServices.ps1
LSP: starting in D:\Amjad\PowerShellEditorServices
LSP: starting ['pwsh', '-NoLogo', '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', "D:/Amjad/PowerShellEditorServices/module/PowerShellEditorServices/Start-EditorServices.ps1 -LogPath D:/Amjad/pses.log -LogLevel Normal -SessionDetailsPath D:/Amjad/session.json -FeatureFlags @() -HostName 'Sublime Text' -HostProfileId subl -HostVersion 1.0.0 -AdditionalModules @() -BundledModulesPath D:/Amjad/PowerShellEditorServices/module -Stdio"]
LSP:  --> initialize
LSP: window 2 added session powershell-ls
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionOptions': {'writeOutputToHost': False, 'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeErrorsToHost': False}, 'hadErrors': False, 'executionStatus': 1}
LSP: Unhandled notification powerShell/executionStatusChanged
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionOptions': {'writeOutputToHost': False, 'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeErrorsToHost': False}, 'hadErrors': True, 'executionStatus': 4}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Finding descriptor for initialize
powershell-ls: Starting: Routing Request (1) initialize
powershell-ls: Converting params for Request (1) initialize to OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionOptions': {'writeOutputToHost': False, 'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeErrorsToHost': False}, 'hadErrors': False, 'executionStatus': 1}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Attempting to execute command(s):



    Set-Location -Path D:/Amjad/PowerShellEditorServices


powershell-ls: Session state changed --



    Old state: Ready

    New state: Running

    Result: NotFinished
powershell-ls: Session state changed --



    Old state: Running

    New state: Ready

    Result: Completed
powershell-ls: Execution completed successfully.
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionOptions': {'writeOutputToHost': False, 'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeErrorsToHost': False}, 'hadErrors': False, 'executionStatus': 4}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Result was System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2+<Handle>d__5[[OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]], OmniSharp.Extensions.LanguageServer, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]]
powershell-ls: Response value was OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult
powershell-ls: Finished: Routing Request (1) initialize in 166ms
LSP:      {'capabilities': {'workspaceSymbolProvider': True, 'documentFormattingProvider': True, 'codeLensProvider': {'resolveProvider': True}, 'documentHighlightProvider': True, 'hoverProvider': True, 'completionProvider': {'resolveProvider': True, 'triggerCharacters': ['.', '-', ':', '\\']}, 'referencesProvider': True, 'codeActionProvider': {'codeActionKinds': ['quickfix']}, 'experimental': {}, 'documentSymbolProvider': True, 'definitionProvider': True, 'textDocumentSync': 0, 'documentRangeFormattingProvider': True, 'signatureHelpProvider': {'triggerCharacters': [' ']}}}
LSP:  --> initialized
powershell-ls: Finding descriptor for initialized
powershell-ls: Starting: Routing Notification initialized
powershell-ls: Converting params for Notification initialized to OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializedParams
powershell-ls: Finished: Routing Notification initialized in 177ms

on hover

LSP:  --> textDocument/hover
powershell-ls: Finding descriptor for textDocument/hover
powershell-ls: Found attributes 1, powershell::file:///D:/Amjad/PowerShellEditorServices/module/PowerShellEditorServices/Start-EditorServices.ps1
powershell-ls: Looking for handler for descriptors textDocument/hover
powershell-ls: Checking handler textDocument/hover:Microsoft.PowerShell.EditorServices.Handlers.HoverHandler
powershell-ls: Registration options OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions
powershell-ls: Document Selector [powershell]
powershell-ls: Handler Selected: Microsoft.PowerShell.EditorServices.Handlers.HoverHandler via [powershell] (targeting OmniSharp.Extensions.JsonRpc.IJsonRpcRequestHandler`2[[OmniSharp.Extensions.LanguageServer.Protocol.Models.HoverParams, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]])
powershell-ls: Starting: Routing Request (2) textDocument/hover
powershell-ls: Converting params for Request (2) textDocument/hover to OmniSharp.Extensions.LanguageServer.Protocol.Models.HoverParams
powershell-ls: Resolved path: D:\Amjad\PowerShellEditorServices\module\PowerShellEditorServices\Start-EditorServices.ps1
powershell-ls: Opened file on disk: D:\Amjad\PowerShellEditorServices\module\PowerShellEditorServices\Start-EditorServices.ps1
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionStatus': 1, 'hadErrors': False, 'executionOptions': {'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeOutputToHost': False, 'writeErrorsToHost': False}}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Attempting to execute command(s):



    Microsoft.PowerShell.Core\Get-Command Start-Transcript -ErrorAction Ignore


powershell-ls: Session state changed --



    Old state: Ready

    New state: Running

    Result: NotFinished
powershell-ls: Session state changed --



    Old state: Running

    New state: Ready

    Result: Completed
powershell-ls: Execution completed successfully.
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionStatus': 4, 'hadErrors': False, 'executionOptions': {'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeOutputToHost': False, 'writeErrorsToHost': False}}
LSP: Unhandled notification powerShell/executionStatusChanged
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionStatus': 1, 'hadErrors': False, 'executionOptions': {'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeOutputToHost': False, 'writeErrorsToHost': False}}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Attempting to execute command(s):



    Microsoft.PowerShell.Core\Get-Help Start-Transcript -ErrorAction Ignore


powershell-ls: Session state changed --



    Old state: Ready

    New state: Running

    Result: NotFinished
powershell-ls: Session state changed --



    Old state: Running

    New state: Ready

    Result: Completed
powershell-ls: Execution completed successfully.
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionStatus': 4, 'hadErrors': False, 'executionOptions': {'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeOutputToHost': False, 'writeErrorsToHost': False}}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Result was System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2+<Handle>d__5[[OmniSharp.Extensions.LanguageServer.Protocol.Models.HoverParams, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]], OmniSharp.Extensions.LanguageServer, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]]
powershell-ls: Response value was OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover
powershell-ls: Finished: Routing Request (2) textDocument/hover in 145ms
LSP:      {'contents': [{'language': 'PowerShell', 'value': 'function Start-Transcript'}, {'language': 'markdown', 'value': '\r\nStart-Transcript [[-Path] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]\r\n\r\nStart-Transcript [[-LiteralPath] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]\r\n\r\nStart-Transcript [[-OutputDirectory] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]\r\n'}], 'range': {'start': {'line': 115, 'character': 4}, 'end': {'line': 115, 'character': 20}}}

image

shouldn't there be any docstring or only signatures ?

this is for the definition request:

LSP:  --> textDocument/definition
powershell-ls: Finding descriptor for textDocument/definition
powershell-ls: Found attributes 1, powershell::file:///D:/Amjad/PowerShellEditorServices/module/PowerShellEditorServices/Start-EditorServices.ps1
powershell-ls: Looking for handler for descriptors textDocument/definition
powershell-ls: Checking handler textDocument/definition:Microsoft.PowerShell.EditorServices.Handlers.DefinitionHandler
powershell-ls: Registration options OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions
powershell-ls: Document Selector [powershell]
powershell-ls: Handler Selected: Microsoft.PowerShell.EditorServices.Handlers.DefinitionHandler via [powershell] (targeting OmniSharp.Extensions.JsonRpc.IJsonRpcRequestHandler`2[[OmniSharp.Extensions.LanguageServer.Protocol.Models.DefinitionParams, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.LocationOrLocationLinks, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]])
powershell-ls: Starting: Routing Request (5) textDocument/definition
powershell-ls: Converting params for Request (5) textDocument/definition to OmniSharp.Extensions.LanguageServer.Protocol.Models.DefinitionParams
powershell-ls: Resolved path: D:\Amjad\PowerShellEditorServices\module\PowerShellEditorServices\Start-EditorServices.ps1
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionStatus': 1, 'hadErrors': False, 'executionOptions': {'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeOutputToHost': False, 'writeErrorsToHost': False}}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Attempting to execute command(s):



    Microsoft.PowerShell.Core\Get-Command Write-Verbose -ErrorAction Ignore


powershell-ls: Session state changed --



    Old state: Ready

    New state: Running

    Result: NotFinished
powershell-ls: Session state changed --



    Old state: Running

    New state: Ready

    Result: Completed
powershell-ls: Execution completed successfully.
LSP: <--  powerShell/executionStatusChanged
LSP:      {'executionStatus': 4, 'hadErrors': False, 'executionOptions': {'writeInputToHost': False, 'interruptCommandPrompt': False, 'addToHistory': False, 'writeOutputToHost': False, 'writeErrorsToHost': False}}
LSP: Unhandled notification powerShell/executionStatusChanged
powershell-ls: Result was System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.LocationOrLocationLinks, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2+<Handle>d__5[[OmniSharp.Extensions.LanguageServer.Protocol.Models.DefinitionParams, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.LocationOrLocationLinks, OmniSharp.Extensions.LanguageProtocol, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]], OmniSharp.Extensions.LanguageServer, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]]
powershell-ls: Response value was OmniSharp.Extensions.LanguageServer.Protocol.Models.LocationOrLocationLinks
powershell-ls: Finished: Routing Request (5) textDocument/definition in 2318ms
LSP:      []
@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 5, 2019

Check Get-Help Start-Transcript you might not have any help installed (run Update-Help to update help on your machine) but that hover looks correct to me.

@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 5, 2019

Oh you're building from source! Nice! The logs are a bit unhelpful in source right now because of a massive refactor of the code. You could use a latest release from the GitHub releases.

Can you share the script you're trying to run with "Go to definition"?

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 5, 2019

Can you share the script you're trying to run with "Go to definition"?

Write-Verbose "`n#-- $msg $('-' * ([Math]::Max(0, 73 - $msg.Length)))"

Check Get-Help Start-Transcript you might not have any help installed (run Update-Help to update help on your machine) but that hover looks correct to me.

I guess it's a problem of Help Files:

PS C:\Users\User> Get-Help Start-Transcript

NAME
    Start-Transcript

SYNTAX
    Start-Transcript [[-Path] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader]
    [-WhatIf] [-Confirm] [<CommonParameters>]

    Start-Transcript [[-LiteralPath] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader]
    [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]

    Start-Transcript [[-OutputDirectory] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader]
    [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]


ALIASES
    None


REMARKS
    Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
        -- To download and install Help files for the module that includes this cmdlet, use Update-Help.
        -- To view the Help topic for this cmdlet online, type: "Get-Help Start-Transcript -Online" or
           go to https://go.microsoft.com/fwlink/?LinkID=113408.


PS C:\Users\User> Update-Help
Update-Help : Failed to update Help for the module(s) 'Defender, WindowsDeveloperLicense' with UI culture(s) {fr-FR} : A Help URI cannot contain more than 10 redirections. Specify a valid Help URI.
At line:1 char:1
+ Update-Help
+ ~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : TooManyRedirections,Microsoft.PowerShell.Commands.UpdateHelpCommand

Update-Help : Failed to update Help for the module(s) 'WindowsUpdateProvider' with UI culture(s) {fr-FR} : One or more errors occurred. (Response status code does not indicate success: 404 (Not Found).)
At line:1 char:1
+ Update-Help
+ ~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : UnknownErrorId,Microsoft.PowerShell.Commands.UpdateHelpCommand
@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 5, 2019

@AmjadHD wait so you're trying to "go to definition" on Write-Verbose? That's not going to work because Write-Verbose comes from a binary module and not script. (this does ask a greater question of how we could support that experience... But we don't have the resources to take it on at the moment).

You should write a function like:

function Get-Foo {

} 

Get-Foo # trigger go to definition on this reference here

That will prove if it's working or not.

Also, those errors you see in Update-Help can be ignored. Try running Get-Help Start-Transcript again. It should have content now.

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 5, 2019

@AmjadHD wait so you're trying to "go to definition" on Write-Verbose? That's not going to work because Write-Verbose comes from a binary module and not script. (this does ask a greater question of how we could support that experience... But we don't have the resources to take it on at the moment)

Oh, I got it

You should write a function like:

function Get-Foo {

}

Get-Foo # trigger go to definition on this reference here

That will prove if it's working or not.

in this case it works

Also, those errors you see in Update-Help can be ignored. Try running Get-Help Start-Transcript again. It should have content now.

still no docs

PS C:\Users\User> Get-Help Start-Transcript

NAME
    Start-Transcript

SYNTAX
    Start-Transcript [[-Path] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader]
    [-WhatIf] [-Confirm] [<CommonParameters>]

    Start-Transcript [[-LiteralPath] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader]
    [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]

    Start-Transcript [[-OutputDirectory] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader]
    [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]


ALIASES
    None


REMARKS
    Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
        -- To download and install Help files for the module that includes this cmdlet, use Update-Help.
        -- To view the Help topic for this cmdlet online, type: "Get-Help Start-Transcript -Online" or
           go to https://go.microsoft.com/fwlink/?LinkID=113408.
@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 5, 2019

Hmm I guess Start-Transcript doesn't have docs. That's odd. You're using PowerShell 6 though, right?

The docs should match this https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-6

You may need to run PowerShell as admin and run Update-Help

@corbob

This comment has been minimized.

Copy link
Contributor

@corbob corbob commented Oct 5, 2019

You may need to run PowerShell as admin and run Update-Help

My goto on Windows is to run PowerShell as admin and do Update-Help -Force

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 5, 2019

running powershell as admin, didn't work

PowerShell 6.2.3
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS C:\Windows\system32> Update-Help
Update-Help : Failed to update Help for the module(s) 'Defender, WindowsDeveloperLicense' with UI culture(s) {fr-FR} : A Help URI cannot contain more than 10 redirections. Specify a valid Help URI.
At line:1 char:1
+ Update-Help
+ ~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : TooManyRedirections,Microsoft.PowerShell.Commands.UpdateHelpCommand

Update-Help : Failed to update Help for the module(s) 'WindowsUpdateProvider' with UI culture(s) {fr-FR} : One or more errors occurred. (Response status code does not indicate success: 404 (Not Found).)
At line:1 char:1
+ Update-Help
+ ~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : UnknownErrorId,Microsoft.PowerShell.Commands.UpdateHelpCommand

PS C:\Windows\system32> Update-Help -Force
Update-Help : Failed to update Help for the module(s) 'Defender, WindowsDeveloperLicense' with UI culture(s) {fr-FR} : A Help URI cannot contain more than 10 redirections. Specify a valid Help URI.
At line:1 char:1
+ Update-Help -Force
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : TooManyRedirections,Microsoft.PowerShell.Commands.UpdateHelpCommand

Update-Help : Failed to update Help for the module(s) 'WindowsUpdateProvider' with UI culture(s) {fr-FR} : One or more errors occurred. (Response status code does not indicate success: 404 (Not Found).)
At line:1 char:1
+ Update-Help -Force
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : UnknownErrorId,Microsoft.PowerShell.Commands.UpdateHelpCommand

PS C:\Windows\system32> Get-Help Start-Transcript

NAME
    Start-Transcript

SYNTAX
    Start-Transcript [[-Path] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]

    Start-Transcript [[-LiteralPath] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader] [-WhatIf] [-Confirm] [<CommonParameters>]

    Start-Transcript [[-OutputDirectory] <string>] [-Append] [-Force] [-NoClobber] [-IncludeInvocationHeader] [-UseMinimalHeader] [-WhatIf] [-Confirm]
    [<CommonParameters>]


ALIASES
    None


REMARKS
    Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
        -- To download and install Help files for the module that includes this cmdlet, use Update-Help.
        -- To view the Help topic for this cmdlet online, type: "Get-Help Start-Transcript -Online" or
           go to https://go.microsoft.com/fwlink/?LinkID=113408.


PS C:\Windows\system32>

this issue is probably getting off-topic, I'll see if I can open this elsewhere, thanks for the help

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 5, 2019

I tried Get-Help Start-Transcript in my old powershell (v5.1) and it asked me to update help and it did successfully:

Windows PowerShell
Copyright (C) Microsoft Corporation. Tous droits réservés.

PS C:\Windows\system32> Get-Help Start-Transcript

Voulez-vous exécuter Update-Help ?
L’applet de commande Update-Help télécharge les fichiers d’aide les plus récents pour les modules Windows PowerShell et les
installe sur votre ordinateur. Pour plus d’informations sur l’applet de commande Update-Help, voir
https://go.microsoft.com/fwlink/?LinkId=210614.
[O] Oui  [N] Non  [S] Suspendre  [?] Aide (la valeur par défaut est « O ») : o

NOM
    Start-Transcript

RÉSUMÉ
    Creates a record of all or part of a Windows PowerShell session to a text file.


SYNTAXE
    Start-Transcript [[-LiteralPath] <String>] [-Append] [-Confirm] [-Force] [-IncludeInvocationHeader] [-NoClobber]
    [-WhatIf] [<CommonParameters>]

    Start-Transcript [[-OutputDirectory] <String>] [-Append] [-Confirm] [-Force] [-IncludeInvocationHeader] [-NoClobber]
    [-WhatIf] [<CommonParameters>]

    Start-Transcript [[-Path] <String>] [-Append] [-Confirm] [-Force] [-IncludeInvocationHeader] [-NoClobber] [-WhatIf]
    [<CommonParameters>]


DESCRIPTION
    The Start-Transcript cmdlet creates a record of all or part of a Windows PowerShell session to a text file. The
    transcript includes all command that the user types and all output that appears on the console.

    Starting in Windows PowerShell 5.0, Start-Transcript includes the host name in the generated file name of all
    transcripts. This is especially useful when your enterprise's logging is centralized. Files that are created by the
    Start-Transcript cmdlet include random characters in names to prevent potential overwrites or duplication when two or
    more transcripts are started simultaneously. This also prevents unauthorized discovery of transcripts that are stored in
    a centralized file share. Additionally in Windows PowerShell 5.0, the Start-Transcript cmdlet works in Windows
    PowerShell ISE.


LIENS CONNEXES
    Online Version: http://go.microsoft.com/fwlink/?LinkId=821532
    Stop-Transcript

REMARQUES
    Pour consulter les exemples, tapez : "get-help Start-Transcript -examples".
    Pour plus d'informations, tapez : "get-help Start-Transcript -detailed".
    Pour obtenir des informations techniques, tapez : "get-help Start-Transcript -full".
    Pour l’aide en ligne, tapez : "get-help Start-Transcript -online"


PS C:\Windows\system32> Get-Help Start-Transcript

NOM
    Start-Transcript

RÉSUMÉ
    Creates a record of all or part of a Windows PowerShell session to a text file.


SYNTAXE
    Start-Transcript [[-LiteralPath] <String>] [-Append] [-Confirm] [-Force] [-IncludeInvocationHeader] [-NoClobber] [-WhatIf] [<CommonParameters>]

    Start-Transcript [[-OutputDirectory] <String>] [-Append] [-Confirm] [-Force] [-IncludeInvocationHeader] [-NoClobber] [-WhatIf] [<CommonParameters>]

    Start-Transcript [[-Path] <String>] [-Append] [-Confirm] [-Force] [-IncludeInvocationHeader] [-NoClobber] [-WhatIf] [<CommonParameters>]


DESCRIPTION
    The Start-Transcript cmdlet creates a record of all or part of a Windows PowerShell session to a text file. The transcript includes all command that the user types and all output that
    appears on the console.

    Starting in Windows PowerShell 5.0, Start-Transcript includes the host name in the generated file name of all transcripts. This is especially useful when your enterprise's logging is
    centralized. Files that are created by the Start-Transcript cmdlet include random characters in names to prevent potential overwrites or duplication when two or more transcripts are
    started simultaneously. This also prevents unauthorized discovery of transcripts that are stored in a centralized file share. Additionally in Windows PowerShell 5.0, the Start-Transcript
    cmdlet works in Windows PowerShell ISE.


LIENS CONNEXES
    Online Version: http://go.microsoft.com/fwlink/?LinkId=821532
    Stop-Transcript

REMARQUES
    Pour consulter les exemples, tapez : "get-help Start-Transcript -examples".
    Pour plus d'informations, tapez : "get-help Start-Transcript -detailed".
    Pour obtenir des informations techniques, tapez : "get-help Start-Transcript -full".
    Pour l’aide en ligne, tapez : "get-help Start-Transcript -online"


PS C:\Windows\system32>
@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 5, 2019

I replaced pwsh in the command with the old powershell and now docstrings are showing up:
image

@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 5, 2019

@AmjadHD what version of pwsh were you using?

@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 5, 2019

@TylerLeonhardt

This comment has been minimized.

Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Oct 5, 2019

P.s. @AmjadHD I think you're unblocked on getting PowerShell Editor Services working. I have a doc PR out now to add steps to the PSES Readme to help folks in the future.

Are you thinking about shipping a PowerShell extension on the Sublime marketplace? If so, we have an email list for folks who own extensions on other editor marketplaces! We'd love to add someone for Sublime :)

@AmjadHD

This comment has been minimized.

Copy link
Author

@AmjadHD AmjadHD commented Oct 5, 2019

@AmjadHD what version of pwsh were you using?

6.2.3

Are you thinking about shipping a PowerShell extension on the Sublime marketplace?

Actually no, but i'm looking to add these configuration to the default configurations of LSP, maybe in the future we'll have an extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.