How to show line numbers of a python notebook in Visual Studio Code - visual-studio-code

I think it should be quite straightforward, however, I cannot seem to find this option in visual studio code.
Could you tell me if it is possible and how to enable line numbers in visual studio code when coding in a python notebook?
FYI: it is possible to use visual studio code with a python notebook (you can check more info here)

You have to press L after clicking on the left side of the code block.

as mention in the link provided you just need to press the L key
https://code.visualstudio.com/docs/python/jupyter-support#_enabledisable-line-numbers

Related

Prolog: How can I set "gtrace" correctly in Visual Studio Code?

I have SWI-Prolog 8.2.4 installed, and I was trying to get it to work in Visual Studio Code with the extension "VSC-Prolog" made by Arthurwang.
If I try to run a program, everything works correctly, however I realized that I cannot use the gtrace tool, because when I try to do it, a strange message appears on the console asking me if I was not wrong and I wanted to write "trace" (which is something different than what I'm looking for).
What I tried later is to write gtrace in the console but outside of Visual Studio Code to see if there I could make use of that tool. However, the same problem appears:
However, if I open swi-prolog's default text editor (swipl-win.exe), gtrace works fine there.
Why could this be happening, and how could I fix it?
Hope I can use prolog correctly in Visual Studio Code.

Can you create check boxes in the command palette in Visual Studio Code

I am thinking about creating an extension in Visual Studio Code. However, I originally wanted to create a dialog with entries and check boxes. It seems that it is not possible to make custom UI dialogs and that everything runs through the command palette. Is there a way to have check boxes in the command palette for an extension?
From what I've seen through digging into different tutorials and documentation check boxes seem like it is impossible to implement in Visual Studio Code.

How to assimilate into visual studio code from visual studio ( the difference of hotkeys )?

I have been using VS for years. I'm trying to use vscode to develop frontend project.
This is my first time touching visual studio code. I feel the hotkeys are so different when compared with visual studio 2015. For example, format code in VS is ctrl+k+f and format code in visual studio 2015 is shift+alf+f. If I even want to perform a simple copy/paste folder operation I also cannot.
As I know, visual studio code supports customized hotkeys. So, I think that someone may have already config the hotkeys in a form like visual studio 2015.
However, I'm not sure this is even possible.
Please give me some suggestion or direction.
There are a few ways to solve this:
manually recreating all the keys you love from Visual Studio in your keybindings.json
Hoping somebody else has made one that you can copy and paste into your keybindings.json -- I can't find any
Find one in the marketplace. There are a few keybinding extensions, but I don't see any for Visual Studio, though there is a Resharper one if you're used to that.
If you do end up doing number 1, you could benefit the community by bundling it as an extension to share on the marketplace.
Edit: typo. exceptions -> extensions

How to copy formatted code to clipboard in VS Code

In Visual Studio Code, is it possible to copy selected code to the clipboard with the syntax highlighting? I want to be able to paste into a Word doc or e-mail.
Regular Visual Studio does this by default (it puts both text and RTF formats on the clipboard).
I see that I can "Toggle Developer Tools" and locate the div (with class="view-lines") that has the code, so maybe there is a way to use that chunk of html, but I don't see an easy way to just copy the formatted code and paste into Word or an e-mail.
According to the 1.10 changelog : https://code.visualstudio.com/updates/v1_10#_copy-with-syntax-highlighting
It is now possible with that command : editor.action.clipboardCopyWithSyntaxHighlightingAction
Type/paste it in command box (ctrl+shift+p or F1)
Use the command "Copy With Syntax Highlighting".
Highlight the code
Ctrl + Shift + p to open the Command Palette
Type / Select Copy With Syntax Highlighting
It is available since VS Code v1.43 (Feb 2020), as #robert4 mentioned in comment.
Ran into this question as I was trying to copy and paste with syntax highlighting from Visual Studio (not Code). As far as I see, it is not possible OOTB.
I am using Visual Studio Enterprise 2019 (v16.7.4), trying to copy C# code (tried CSHTML also).
BUT, I found this article, which seemed to indicate that Visual Studio Code OOTB would Ctrl+C Ctrl+V right into an Outlook email or Word document without a plugin or fancy keyboard shortcut, and I was successful!
I am using Visual Studio Code v1.49.2, and copying C# code. Copying CSHTML also worked.
I took the suggestion above, went to the command pallet, clicked on the clog to the right, and used ctl + c for the key bindings. Now, when I copy from VSCode to OneNote, I get the source formatting. It works!

How do I auto-indent Python code in Visual Studio Code?

I'm using Visual Studio Code (not Visual Studio) on Linux and I can't seem to find out how to turn on auto-indentation for Python. I've looked all over preferences, spent some time on Google, and can't find anything.
Does anyone know how to do this?
In VS Code you can set the indentation in several places :
General/Workspace settings (bottom bar),
User settings,
language formatter settings.
When using Python, no matter what settings you set, all of them are overridden by the autopep8Args value of the autopep8 language formatter setting, which has an indent size of 4.
By default, autopep8 is used as VS Code Python formatter, but there are others, like yapf.
To update the indent size of this formatter, search in your user settings the "python.formatting.autopep8Args" and set it to : ["--indent-size=2"],
"python.formatting.autopep8Args": ["--indent-size=2"],
Visual Studio Code doesn't have much support for Python (yet), aside from syntax-highlighting, and per-file intellisense (meaning it'll provide suggestions for symbols that have been found within the current file).
I'm willing to bet that the Visual Studio Code team will, eventually, increase their support for Python within Visual Studio Code, and with this, they'll likely add support for auto-indentation.
In the meantime, it might be worth trying this Visual Studio Code extension, which aims to add better support for Python, into Visual Studio Code.
The extension does add auto-indentation for Python, to Visual Studio Code, along with many other features.
Happy scripting!
I auto-format python with autopep8, vscode can use it. It can be easily configured for tab-size and other stuff creating the config file: $HOME/.config/pep8
Here an example of that file:
[pep8]
indent-size = 2
max-line-length = 100