Disable untitled editor improvement - first line name in the title - visual-studio-code

Is there any to revert/disable the newest change for the untitled tab name (https://code.visualstudio.com/updates/v1_42#_untitled-editor-improvements)
I would prefer to the untitled-1 than the first sentence line.

As your link says:
Note: If the first line is empty or does not contain any words, the
title will fall back to Untitled-* as before.
I don't think there is a way to disable it other than to have that first line blank until you do give it a name.
The request for a setting to disable the current functionality is tracked here: https://github.com/microsoft/vscode/issues/90378 (Config to limit/disable the new Untitled tab auto-naming) or https://github.com/microsoft/vscode/issues/90495
you could upvote that issue.
---------- update, coming in v1.43:
A new setting workbench.editor.untitled.labelFormat lets you control
whether untitled editors should use the file contents as the title or
not. Possible values are content or name. Configure
'workbench.editor.untitled.labelFormat': 'name' for the previous
behavior, where untitled editors would have a short title, such as
Untitled-1.
When pasting text into an untitled editor, VS Code now automatically
tries to detect the language mode from the first line of text. For
example, pasting XML will set the XML mode automatically upon paste if
the first line contains the typical XML header .

Related

TinyMce paste from the context menu does not work right when pasting onto a blank line

When copying and pasting using the Context menu (on a Macbook Pro), the paste doesn't work as expected when pasting to a new line. The text is inserted at the end of the previous line. Has anyone observed this behavior and, if so, have you found a fix?
Here's what I'm seeing:
Go to the latest "demo" TinyMce page (https://www.tiny.cloud/docs/tinymce/6/)
Add at least two lines of text but leave one or more blank lines between the two lines of text.
Copy (using the context menu) some text from the line following the blank line.
Click on the blank line.
Paste the text using the context menu.
I would expect the text to be inserted after the linefeed.
Instead, it appears that the linefeed is overwritten by the text in the paste buffer because the blank line is deleted and the pasted text appears at the end of the previous line.
The cmd-V shortcut doesn't exhibit this behavior

Visual Studio Code select same position above and below not the whole line before and after (see image)

I'm using visual studio code and run into a weird problem. I'm not sure how I got here - I could have accidently pressed a shortcut unknowingly.
I'm trying to select a phrase, link or anything that crosses multiple lines (whether the lines are true lines or due to word wrap). When I select multiple lines, it doesn't automatically select the text at the start and end between the two points. Rather, it just selects the length of text for that line and repeats it in the subsequent lines. See the image below to understand.
Image of issue
As you can see, I am trying to select the words from "the" to the end of "sub". Instead of selecting all the words between the two, it selects the text "the instru" and selects every line with the same amount of characters/length.
In order to show what I am expecting, I have pasted the text into Notepad and done the same thing.
What I am expecting
As you can see, all the words between "the" and "sub" are selected.
If anyone has any idea about how to fix this, I would be greatly appreciative.
Below is a copy of the text if the images don't display.
Follow the instructions below for a click guide to retire and/or add 'School'.
Best practice if there is a change in 'School' structure would be to 'retire' any existing school setup that is no longer required and add the new sub school information. The reason why we don't just edit existing school names (typically) is due to leaving historical data intact.
Try using ctrl+shift+P and typing "Toggle Column Selection Mode"

VSCode will copy full line when only a word is selected (single click)

I'm on OSX and running Version 1.42.0 of Visual Studio Code. I have noticed that when I single click a word it will highlight. But if I copy CMD + c and then paste CMD+v, the full line will be in the clipboard. This causes problems from time to time, when the screen has given me every indication that I have only selected a single word. Is there some setting that I can set that will make the default behavior to select a word on a single quote and never ghost select a full line?
What it looks like when I single click a word:
And what it looks like after I've copied and pasted:
After filing an issue, it turns out that this behavior is by design.
The word the cursor is on (from a single click) is highlighted along with every occurrence of that word. The word is not selected (that would be a deeper blue).
By default copying without a selection copies the current line.
This in my opinion is an Accessibility issue, as there are strong visual clues that a word is selected. I have found that the behavior can be made more intuitive if you set these to settings.
// Controls whether copying without a selection copies the current line.
"editor.emptySelectionClipboard": false,
// Controls whether the editor should highlight semantic symbol occurrences.
"editor.occurrencesHighlight": false
With these two settings the word the cursor is on will not be highlighted (nor any other occurrences of that word). And if you do happen to copy, with an empty selection, the editor will behave similar to how other applications behave and not copy the current line.

Change title of untitled tab in Visual Studio Code

I'm building a VS Code extension which includes changing the name/title of untitled-1 tab (unsaved file).
I tried running the below code in debugger console of extension but it didn't reflect in the editor:
vscode.workspace.textDocuments[0].fileName="myFile"
Is it not possible or am I missing something?
It is still (Q1 2020) not possible, but the next VSCode 1.42 will name its Untitled editors differently.
Untitled editors in VS Code are text buffers that have not yet been saved to disk.
You can leave them open for as long as you like and all text content is stored and restored between restarts.
Untitled editors were given generic names such as Untitled-1 and counting upwards.
In this release, untitled editors will use the content of the first line of the document for the editor title, and include the generic name as part of the description:
Note: If the first line is empty or does not contain any words, the title will fall back to Untitled_* as before.
So while you cannot set the title yourself (still readonly fileName), technically... changing the first line of that file would be enough to change the title of said "Untitled" editor.
With VSCode 1.43 (Q1 2020), a new setting workbench.editor.untitled.labelFormat allows to control whether untitled editors should use the contents as title or not.
Possible values are content or name.
Configure 'workbench.editor.untitled.labelFormat': 'name' to get the previous behavior back where untitled editors would have a short title, such as Untitled-1.
It's not possible - if you check out the source code for the API definition in vscode.d.ts, you'll see that fileName is declared as readonly:
export interface TextDocument {
// ...
readonly fileName: string;
// ...
}
Unfortunately, it seems that the readonly attribute isn't reflected in the API docs on the website.
This mainly happens if we create a new file in the OPEN EDITORS section, thus they appear as unsaved. To prevent this, create a folder for storing your files, and then in that folder, create your new file then it will show options to name it, also you can add a file type extension like .cpp.
TIP: vsc-rename-files extension to rename your files.

Copy code example from Zend Site

How would you copy the code from this example page
http://framework.zend.com/manual/en/learning.quickstart.create-layout.html
(Below the text "Now that we've initialized Zend_Layout and set the Doctype, let's create our site-wide layout:" )
A simple copy paste will also copy the line number or #. Any tricks ?
I hate these line numbers as well. The way I do it:
Copy the text to your favorite text editor (notepad won't do, Word for example would) and block-select using the ALT Key.
Let me give you an example with Notepad++. here I copied text from the said site with all line numbers included. Now I just hold the ALT button and select normally with my mouse (or using SHIFT+arrow keys). The result of me selecting only the code sans the line numbers you see in the following screenshot:
Now I could just copy this code to a new editor.