Skip to content

Command Run Selected Text in active Terminal doen't execute Command when a NewLine is Selected #1278

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

Closed
fbehrens opened this issue Apr 19, 2018 · 8 comments

Comments

@fbehrens
Copy link

Hi,
i just want to report a little detail which would help my transition from sublime to vsCode.
I am used to develop in a very interactive way, where I am always pasting code from my editor to a terminal window.

I observed that the VsVode integrated Terminal seem to paste line by line, and can't handle multiline snippets as:

@{
    a=1
}

However this extensions comes with an own Powershell Terminal-Window where this is "almost" working. I said "almost" because when I select above Hash with a training newline (which happens naturally if you select with shift+down ) and then execute the command Run Selected Text in active Terminal the code is pasted but not executed (see following result):

PS C:\scripts2\libwba> @{
>>   a=1
>> }
>>

I have to then switch to the terminal and press enter to execute it.

I would consider it helpful if you would change the behaviour,
so that the command is executed when a final newline is selected.

@TylerLeonhardt
Copy link
Member

@fbehrens welcome to VSCode! 😄

Let me address your comments:

As a work around, you should try this feature of VSCode...

Select some code in your editor and hit F8! That will run the selected code in the Integrated terminal. That supports multiline.

@fbehrens
Copy link
Author

fbehrens commented Apr 23, 2018

@tylerl0706 Thanks a lot. F8 works great for me.

Looking forward for PSReadline support.

Another little feedback is the feature that i miss the most is Goto Symbol in Workspace having all Powershell functions.

@TylerLeonhardt
Copy link
Member

Is that the same as "Go To Definition"? If so, try pressing F12 on a function that's getting called and it should jump to where the function is defined in your workspace.

Note, if the function is from a module or script in another file, and you use Import-module or dot sourcing to pull that in to your current file, you may need to run (using F8) the Import-module / dot sourcing line so that the file is "loaded" into the runspace that the extension uses.

@fbehrens
Copy link
Author

@tylerl0706 Mucho thanks, again. I learned that the editor is connected via the Language Service to the Powershell Integrated Console. Yes I knew about F12 and the forward/back navigation. But what I am missing a little, is the feature to fuzzy search in a CTRL-P like selectbox with all my functions.

@TylerLeonhardt
Copy link
Member

Does Ctrl+T or Ctrl+Shift+O do what you're looking for?

@fbehrens
Copy link
Author

  • Ctrl-Shilf-O(goto Symbol in File) is working as expected
  • Ctrl-T(goto Symbol in Workspace) shows only all symbols of opened editors, not all in workspace

@TylerLeonhardt
Copy link
Member

I think Ctrl-T shows symbols that are loaded in the runspace. Example:

Let's say you have 2 files:

  • test.psm1
  • test.ps1

In test.psm1:

function Get-Foo () {
    Write-Host "foo"
}
Export-ModuleMember -Function 'Get-Foo'

in test.ps1:

Import-Module ./test.psm1

If you do an F8 on the Import-Module in test.ps1, then the symbol for Get-Foo shows up.

@fbehrens
Copy link
Author

fbehrens commented Apr 27, 2018

@tylerl0706 thanks for going after this issue. Crtl-T shows only Symbols of opened editors code 1.22.2 vscode-powershell 1.7.0

image

image

and with your example
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants