Question:
<!-- Please search existing issues to avoid creating duplicates. --- VS Code version: 1.59.1 Extension version (available under the Extensions sidebar): v2021.8. OS and version: Linux x64 5.13.11-1-MANJARO Python version (& distribution if applicable, e.g. Anaconda): 3.9 Type of virtual environment used (N/A ...): virtualenvwrapper Relevant/affected Python-related VS Code extensions and their versions: pylance v2021.8.3, jupyter v2021.8., Visual Studio IntelliCode v1.2.14 Value of the setting: Pylance from the VS Code marketplace to see if that fixes your issue] Extension loads successfuly Extension does not load, console reports "Unexpected token ' in JSON at position " [NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue] the extension by clicking a .py file <!-- Note: If you think a GIF of what is happening would be helpful, consider tools like , or . --<details<summaryOutput for <codePython</codein the <codeOutput</codepanel (<codeView</code→<codeOutput</code, change the drop-down the upper-right of the <codeOutput</codepanel to <codePython</code) </summary<p</p</details
Looks like you might have a bad update. Do the following to remove stale versions of the extension: Python extension (if you have pylance uninstall it first). all instances of VS Code. to, (on windows) or on Linux/Mac. any folder with the name starting with VS Code, and install Python extension (also pylance if you uninstalled it in step 1).
I followed all steps, but nothing changed. should I try to install older version of python ext?
Hi Can you try installing an older version of the Python extension, and if it doesn't work can you try a different version of VS Code (either an old one or the Insiders build)?
I've installed python extension , jupyter and no pylance. here's the log: As you said I'm going to install older version of vscode
Hi Did you try installing an older version of VS Code?
FYI - This looks like some JSON stored via the became corrupt. The JSON is written a few lines lower, so it is unexpected that the value is corrupted. This might indicate some kind of bug in the storage layer. I don't remember writing that code, did you perhaps write that? Do you think it is so important such to fail extension activation when the JSON is corrupt, or should we catch that exception and return ?
I would suggest to be more resilient in extension activation as you suggest and fallback to an empty object here if any error rises from but log it as error: This is the first time I hear about a problem with persisting data into SQLite. However, seeing makes me think that this is not an officially supported Linux distribution.
curious if you could share the following 2 files with me (via e-mail is fine: find it on ). Steps: open the VSCode window where this issue happens View Command Palette =Log Storage Database Contents Help Toggle Dev Tools Find the 2 paths for the DBs send both files to me
I can still see the original issue in vscode-insiders v1.61.0-insider
whats the exact version you are on? And is it the issue that the extension fails to activate?
Version: 1.61.0-insider (user setup) Commit: Date: 2021-09-16T08:31:28.161Z Electron: 13.4.0 Chrome: 91.0.4472.164 14.16.0 V8: 9.1.269.39-electron.0 OS: WindowsNT x64 10.0. python extension: v2021.9. Error 2021-09-16 17:51:12: Error discovering pytest tests: [SyntaxError: Unexpected token S in JSON at position at (<anonymous) at a.runTestDiscovery (PATH.vscode-insidersextensionsms-outclient) at runMicrotasks (<anonymous) at processTicksAndRejections () at async (index 0) at async _.refreshTestData (PATH.vscode-insidersextensionsms-outclient) at async v.refreshTestDataInternal (PATH.vscode-insidersextensionsms-outclient)] { stdout: '[{"rootid": ".", "root": "...
I fixed the issue as reported in that extensions fail to activate when the contents in storage fail to get parsed. What you report here seems different to me. Looks like the python extension is calling on something that is not valid JSON? Have you asked the Python extension what this could be?
I see, I'll create a new issue. thanks

extHostContext: IExtHostContext, @IStorageService storageService: IStorageService, @IExtensionsStorageSyncService extensionsStorageSyncService: IExtensionsStorageSyncService, <ins> @ILogService private readonly _logService: ILogService </ins> ) { this._storageService = storageService; this._extensionsStorageSyncService = extensionsStorageSyncService;


Question:
<!-- Please search existing issues to avoid creating duplicates. --- VS Code version: 1.59.1 Extension version (available under the Extensions sidebar): v2021.8. OS and version: Linux x64 5.13.11-1-MANJARO Python version (& distribution if applicable, e.g. Anaconda): 3.9 Type of virtual environment used (N/A ...): virtualenvwrapper Relevant/affected Python-related VS Code extensions and their versions: pylance v2021.8.3, jupyter v2021.8., Visual Studio IntelliCode v1.2.14 Value of the setting: Pylance from the VS Code marketplace to see if that fixes your issue] Extension loads successfuly Extension does not load, console reports "Unexpected token ' in JSON at position " [NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue] the extension by clicking a .py file <!-- Note: If you think a GIF of what is happening would be helpful, consider tools like , or . --<details<summaryOutput for <codePython</codein the <codeOutput</codepanel (<codeView</code→<codeOutput</code, change the drop-down the upper-right of the <codeOutput</codepanel to <codePython</code) </summary<p</p</details
Looks like you might have a bad update. Do the following to remove stale versions of the extension: Python extension (if you have pylance uninstall it first). all instances of VS Code. to, (on windows) or on Linux/Mac. any folder with the name starting with VS Code, and install Python extension (also pylance if you uninstalled it in step 1).
I followed all steps, but nothing changed. should I try to install older version of python ext?
Hi Can you try installing an older version of the Python extension, and if it doesn't work can you try a different version of VS Code (either an old one or the Insiders build)?
I've installed python extension , jupyter and no pylance. here's the log: As you said I'm going to install older version of vscode
Hi Did you try installing an older version of VS Code?
FYI - This looks like some JSON stored via the became corrupt. The JSON is written a few lines lower, so it is unexpected that the value is corrupted. This might indicate some kind of bug in the storage layer. I don't remember writing that code, did you perhaps write that? Do you think it is so important such to fail extension activation when the JSON is corrupt, or should we catch that exception and return ?
I would suggest to be more resilient in extension activation as you suggest and fallback to an empty object here if any error rises from but log it as error: This is the first time I hear about a problem with persisting data into SQLite. However, seeing makes me think that this is not an officially supported Linux distribution.
curious if you could share the following 2 files with me (via e-mail is fine: find it on ). Steps: open the VSCode window where this issue happens View Command Palette =Log Storage Database Contents Help Toggle Dev Tools Find the 2 paths for the DBs send both files to me
I can still see the original issue in vscode-insiders v1.61.0-insider
whats the exact version you are on? And is it the issue that the extension fails to activate?
Version: 1.61.0-insider (user setup) Commit: Date: 2021-09-16T08:31:28.161Z Electron: 13.4.0 Chrome: 91.0.4472.164 14.16.0 V8: 9.1.269.39-electron.0 OS: WindowsNT x64 10.0. python extension: v2021.9. Error 2021-09-16 17:51:12: Error discovering pytest tests: [SyntaxError: Unexpected token S in JSON at position at (<anonymous) at a.runTestDiscovery (PATH.vscode-insidersextensionsms-outclient) at runMicrotasks (<anonymous) at processTicksAndRejections () at async (index 0) at async _.refreshTestData (PATH.vscode-insidersextensionsms-outclient) at async v.refreshTestDataInternal (PATH.vscode-insidersextensionsms-outclient)] { stdout: '[{"rootid": ".", "root": "...
I fixed the issue as reported in that extensions fail to activate when the contents in storage fail to get parsed. What you report here seems different to me. Looks like the python extension is calling on something that is not valid JSON? Have you asked the Python extension what this could be?
I see, I'll create a new issue. thanks

this._storageListener = this._storageService.onDidChangeValue(e => { const shared = e.scope === StorageScope.GLOBAL; if (shared && this._sharedStorageKeysToWatch.has(e.key)) { <del> try { this._proxy.$acceptValue(shared, e.key, this._getValue(shared, e.key)); } catch (error) { // ignore parsing errors that can happen } </del> <ins> this._proxy.$acceptValue(shared, e.key, this._getValue(shared, e.key)); </ins> } }); }


Question:
<!-- Please search existing issues to avoid creating duplicates. --- VS Code version: 1.59.1 Extension version (available under the Extensions sidebar): v2021.8. OS and version: Linux x64 5.13.11-1-MANJARO Python version (& distribution if applicable, e.g. Anaconda): 3.9 Type of virtual environment used (N/A ...): virtualenvwrapper Relevant/affected Python-related VS Code extensions and their versions: pylance v2021.8.3, jupyter v2021.8., Visual Studio IntelliCode v1.2.14 Value of the setting: Pylance from the VS Code marketplace to see if that fixes your issue] Extension loads successfuly Extension does not load, console reports "Unexpected token ' in JSON at position " [NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue] the extension by clicking a .py file <!-- Note: If you think a GIF of what is happening would be helpful, consider tools like , or . --<details<summaryOutput for <codePython</codein the <codeOutput</codepanel (<codeView</code→<codeOutput</code, change the drop-down the upper-right of the <codeOutput</codepanel to <codePython</code) </summary<p</p</details
Looks like you might have a bad update. Do the following to remove stale versions of the extension: Python extension (if you have pylance uninstall it first). all instances of VS Code. to, (on windows) or on Linux/Mac. any folder with the name starting with VS Code, and install Python extension (also pylance if you uninstalled it in step 1).
I followed all steps, but nothing changed. should I try to install older version of python ext?
Hi Can you try installing an older version of the Python extension, and if it doesn't work can you try a different version of VS Code (either an old one or the Insiders build)?
I've installed python extension , jupyter and no pylance. here's the log: As you said I'm going to install older version of vscode
Hi Did you try installing an older version of VS Code?
FYI - This looks like some JSON stored via the became corrupt. The JSON is written a few lines lower, so it is unexpected that the value is corrupted. This might indicate some kind of bug in the storage layer. I don't remember writing that code, did you perhaps write that? Do you think it is so important such to fail extension activation when the JSON is corrupt, or should we catch that exception and return ?
I would suggest to be more resilient in extension activation as you suggest and fallback to an empty object here if any error rises from but log it as error: This is the first time I hear about a problem with persisting data into SQLite. However, seeing makes me think that this is not an officially supported Linux distribution.
curious if you could share the following 2 files with me (via e-mail is fine: find it on ). Steps: open the VSCode window where this issue happens View Command Palette =Log Storage Database Contents Help Toggle Dev Tools Find the 2 paths for the DBs send both files to me
I can still see the original issue in vscode-insiders v1.61.0-insider
whats the exact version you are on? And is it the issue that the extension fails to activate?
Version: 1.61.0-insider (user setup) Commit: Date: 2021-09-16T08:31:28.161Z Electron: 13.4.0 Chrome: 91.0.4472.164 14.16.0 V8: 9.1.269.39-electron.0 OS: WindowsNT x64 10.0. python extension: v2021.9. Error 2021-09-16 17:51:12: Error discovering pytest tests: [SyntaxError: Unexpected token S in JSON at position at (<anonymous) at a.runTestDiscovery (PATH.vscode-insidersextensionsms-outclient) at runMicrotasks (<anonymous) at processTicksAndRejections () at async (index 0) at async _.refreshTestData (PATH.vscode-insidersextensionsms-outclient) at async v.refreshTestDataInternal (PATH.vscode-insidersextensionsms-outclient)] { stdout: '[{"rootid": ".", "root": "...
I fixed the issue as reported in that extensions fail to activate when the contents in storage fail to get parsed. What you report here seems different to me. Looks like the python extension is calling on something that is not valid JSON? Have you asked the Python extension what this could be?
I see, I'll create a new issue. thanks

this._storageListener.dispose(); } <del> $getValue<T>(shared: boolean, key: string): Promise<T | undefined> { </del> <ins> async $getValue<T>(shared: boolean, key: string): Promise<T | undefined> { </ins> if (shared) { this._sharedStorageKeysToWatch.set(key, true); } <del> try { return Promise.resolve(this._getValue<T>(shared, key)); } catch (error) { return Promise.reject(error); } </del> <ins> return this._getValue<T>(shared, key); </ins> } private _getValue<T>(shared: boolean, key: string): T | undefined { const jsonValue = this._storageService.get(key, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE); <del> if (!jsonValue) { return undefined; </del> <ins> if (jsonValue) { try { return JSON.parse(jsonValue); } catch (error) { // Do not fail this call but log it for diagnostics // https://github.com/microsoft/vscode/issues/132777 this._logService.error(`[mainThreadStorage] unexpected error parsing storage contents (key: ${key}, shared: ${shared}): ${error}`); } </ins> } <del> return JSON.parse(jsonValue); </del> <ins> return undefined; </ins> } <del> $setValue(shared: boolean, key: string, value: object): Promise<void> { let jsonValue: string; try { jsonValue = JSON.stringify(value); // Extension state is synced separately through extensions this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE, StorageTarget.MACHINE); } catch (err) { return Promise.reject(err); } return Promise.resolve(undefined); </del> <ins> async $setValue(shared: boolean, key: string, value: object): Promise<void> { this._storageService.store(key, JSON.stringify(value), shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE, StorageTarget.MACHINE /* Extension state is synced separately through extensions */); </ins> } $registerExtensionStorageKeysToSync(extension: IExtensionIdWithVersion, keys: string[]): void {


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers'; import { revive } from 'vs/base/common/marshalling'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; <ins> import { SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier'; </ins> @extHostNamedCustomer(MainContext.MainThreadCommands) export class MainThreadCommands implements MainThreadCommandsShape {


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

} } <del> async $executeCommand<T>(id: string, args: any[], retry: boolean): Promise<T | undefined> { </del> <ins> async $executeCommand<T>(id: string, args: any[] | SerializableObjectWithBuffers<any[]>, retry: boolean): Promise<T | undefined> { if (args instanceof SerializableObjectWithBuffers) { args = args.value; } </ins> for (let i = 0; i < args.length; i++) { args[i] = revive(args[i]); }


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

export interface MainThreadCommandsShape extends IDisposable { $registerCommand(id: string): void; $unregisterCommand(id: string): void; <del> $executeCommand<T>(id: string, args: any[], retry: boolean): Promise<T | undefined>; </del> <ins> $executeCommand<T>(id: string, args: any[] | SerializableObjectWithBuffers<any[]>, retry: boolean): Promise<T | undefined>; </ins> $getCommands(): Promise<string[]>; }


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { ISelection } from 'vs/editor/common/core/selection'; import { TestItemImpl } from 'vs/workbench/api/common/extHostTestingPrivateApi'; <ins> import { VSBuffer } from 'vs/base/common/buffer'; import { SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier'; </ins> interface CommandHandler { callback: Function;


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

if (Range.isIRange((obj as modes.Location).range) && URI.isUri((obj as modes.Location).uri)) { return extHostTypeConverter.location.to(obj); } <ins> if (obj instanceof VSBuffer) { return obj.buffer.buffer; } </ins> if (!Array.isArray(obj)) { return obj; }


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

} else { // automagically convert some argument types <ins> let hasBuffers = false; </ins> const toArgs = cloneAndChange(args, function (value) { if (value instanceof extHostTypes.Position) { return extHostTypeConverter.Position.from(value);


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

return extHostTypeConverter.location.from(value); } else if (extHostTypes.NotebookRange.isNotebookRange(value)) { return extHostTypeConverter.NotebookRange.from(value); <ins> } else if (value instanceof ArrayBuffer) { hasBuffers = true; return VSBuffer.wrap(new Uint8Array(value)); } else if (value instanceof Uint8Array) { hasBuffers = true; return VSBuffer.wrap(value); </ins> } if (!Array.isArray(value)) { return value;


Question:
Currently when using , ArrayBuffers just turn into an empty object. We should support these for efficient data transfer between extensions/extension hosts. We recently support for them on a protocol level, so support here should not be terribly hard...
I see two possible approaches to support this: this logic specifically for commands (or even just for a specific command). This is what we do for webviews for example: our implementation aware of array buffers instead of only supporting VSBuffers. Take a look at how is used in our rpc code as a starting point: The webview serialization logic I linked to above would probably be a good starting point for this

}); try { <del> const result = await this._proxy.$executeCommand<T>(id, toArgs, retry); </del> <ins> const result = await this._proxy.$executeCommand<T>(id, hasBuffers ? new SerializableObjectWithBuffers(toArgs) : toArgs, retry); </ins> return revive<any>(result); } catch (e) { // Rerun the command when it wasn't known, had arguments, and when retry


Question:
Issue Type: <bBug</ba JS file: Fold and place cursor after the opening of the class Bug Nothing happens VS Code version: Code - Insiders 1.61.0-insider (Universal) (, 2021-09-14T05:14:54.400Z) OS version: Darwin x64 20.6.0 Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ salesforce-soql-editor1.8.0 comment-tagged-templates0.3.1 docs-view0.0.9 emojisense0.9.0 folder-source-actions0.2.1 jsdoc-markdown-highlighting0.0.1 markdown-checkbox0.3.2 markdown-emoji0.2.1 markdown-yaml-preamble0.1.0 test-ext0.0.1 vscode-eslint2.1.25 typescript-notebook2.0.3 gitlens11.6.0 tsl-problem-matcher0.4.0 EditorConfig0.16.4 codespaces1.0.5 vscode-pull-request-github-insiders2021.9. vscode-drawio1.6.2 vscode-postfix-ts1.9.4 latex-workshop8.20.2 vscode-platform-specific-sample1.15.0 vscode-platform-specific-sample1.5.0 vscode-memfs0.0.3 template-string-converter0.5.3 vscode-azurefunctions1.5.1 vscode-azureresourcegroups0.4.0 vscode-docker1.16.1 vscode-language-pack-de1.60.3 vscode-edge-devtools1.3.0 python2021.10.-dev vscode-pylance2021.9.2-pre.1 jupyter2021.9. jupyter-keymap1.0.0 remote-containers0.194.0 remote-ssh0.65.7 remote-ssh-edit0.65.7 azure-account0.9.8 hexeditor1.8.2 js-debug-nightly2021.9.417 live-server0.2.8 vscode-github-issue-notebooks0.0.106 vscode-typescript-next4.5. vsliveshare1.0.4836 debugger-for-chrome4.13.0 vetur0.34.1 java0.81.0 code-spell-checker2.0.4 rest-book4.2.0 ayu1.0.5 luna-paint0.9.0 sort-lines1.9.0 vscodeintellicode1.2.14 vscode-java-debug0.35.0 vscode-java-dependency0.18.7 vscode-java-test0.31.3 (2 theme extensions excluded) </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
I'm trying to document this command but find its behavior difficult to understand and rather unpredictable This could be wrong, but I think it tries looking for the next fold above the current level. In the case above, that means that works if you are inside another method: But it doesn't work if you are in the class body I'd expect this command to work more like where it just jumps to the next folded location in the file
FYI Got to next fold looks for the next fold of the same level. In the example above there's no such fold
Thanks for tagging me, The way I have fold jumping working is that it takes the cursor position and figures out what fold you are currently in. From there, it checks if you want the next previous or parent fold. Parent is pretty easy. It just gets the fold that's at level X - 1. For next and previous fold, they are implemented as the next or previous fold at the same level. The reason for that is because it makes it easy to find associated parts of the file. For example, if you are at an , , or fold, you can easily navigate to the other conditions. Similarly, in the above example, if you are on function , you can easily jump to the other functions that are defined. I don't think it's valuable to jump to the next or previous fold by file order. For example, in the below code it would not make sense to me to have jump to next fold go to b1, then c1, then c2, then a2. Please let me know if you want me to make any changes though.
We need a better label then: ?
That seems reasonable. Want me to do that? I probably shouldn't change the actually command ID though, right? That would break key bindings.
Thanks for the explanation. I agree that this should be renamed. Even with a better name though, I still find the behavior from my example confusing. When the cursor is inside the class body, I'd expect that the folding points for and would be siblings to the cursor's location (because they all have the same folding parent). Instead though we jump out of the class entirely
One other note on the name: maybe the command should call these something like instead of ? Conceptually I think of a as being code you've actually folded, but my understanding is that these commands actually jump between foldable lines in the file
sounds good to me. I see how that's confusing, so I put together this JS sample to illustrate where the "next fold" is for different cursor positions: Cursor 2's next is straightforward since you're on a folding point. Cursor 3's next I think is reasonable. You are in a fold, so you find the folding point and go to the next of that. Cursor 1 and 5's next start getting a little weird, but following the same logic as cursor 3, it seems logical that is the folding point, so the next sibling is at . Cursor 4 is basically your original question. I agree that it gets a little confusing. The logic is the same as 1, 3, and 5, but visually, if you're between 2 folding points, I could understand the desire for it to go to those points. I think the confusion stems from using the command when you're not on a folding point line. If you are, I think it's easy to understand, but when you aren't, not so much. What do you think of the following? If you are on a folding point line, do what it does now. not, go to the next folding point sequentially. With those updates, the above example looks like this:
We don't use 'folding points' as a term. I suggest 'folding range'
Ok. What do you think of changing the implementation as I mentioned in my previous comment?
Yes I like the suggestion (I thumbed up it :-) )
I wish I could turn on reaction notifications in GitHub. I implemented this in . I update the command from "Fold" to "Folding Region", but I did not add "Sibling". I hit a bit of a dilemma there. With the change, it's no longer necessarily a sibling. However, I can still see people getting confused by previous or next folding region command "not working" when you are on the first or last sibling folding region's start line. For example, in the above example, the previous command won't move you when you are at . I think that's really valuable. It lets you move up and down the different cases of branches without going past them. I wouldn't want to run previous at and end up at , then next brings me to . Any suggestions for that? I'm pretty sure nobody would want the command label to be "Go to Previous Folding Range, but Stop at First Sibling", but that's essentially what this does.
/verified Looks to follow the logic set out by I used this example: When on line 8 it jumps nowhere is a little confusing, but that's because the next folding range is the current?
That's because it's the last sibling. The benefit is that you can move to previous and next sibling folding ranges without stepping out of them (at which point going to the next or previous sibling won't be the original set of siblings you were on). I agree, it's confusing, but I think it's valuable to do it this way.

constructor() { super({ id: 'editor.gotoPreviousFold', <del> label: nls.localize('gotoPreviousFold.label', "Go to Previous Fold"), alias: 'Go to Previous Fold', </del> <ins> label: nls.localize('gotoPreviousFold.label', "Go to Previous Folding Range"), alias: 'Go to Previous Folding Range', </ins> precondition: CONTEXT_FOLDING_ENABLED, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus,


Question:
Issue Type: <bBug</ba JS file: Fold and place cursor after the opening of the class Bug Nothing happens VS Code version: Code - Insiders 1.61.0-insider (Universal) (, 2021-09-14T05:14:54.400Z) OS version: Darwin x64 20.6.0 Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ salesforce-soql-editor1.8.0 comment-tagged-templates0.3.1 docs-view0.0.9 emojisense0.9.0 folder-source-actions0.2.1 jsdoc-markdown-highlighting0.0.1 markdown-checkbox0.3.2 markdown-emoji0.2.1 markdown-yaml-preamble0.1.0 test-ext0.0.1 vscode-eslint2.1.25 typescript-notebook2.0.3 gitlens11.6.0 tsl-problem-matcher0.4.0 EditorConfig0.16.4 codespaces1.0.5 vscode-pull-request-github-insiders2021.9. vscode-drawio1.6.2 vscode-postfix-ts1.9.4 latex-workshop8.20.2 vscode-platform-specific-sample1.15.0 vscode-platform-specific-sample1.5.0 vscode-memfs0.0.3 template-string-converter0.5.3 vscode-azurefunctions1.5.1 vscode-azureresourcegroups0.4.0 vscode-docker1.16.1 vscode-language-pack-de1.60.3 vscode-edge-devtools1.3.0 python2021.10.-dev vscode-pylance2021.9.2-pre.1 jupyter2021.9. jupyter-keymap1.0.0 remote-containers0.194.0 remote-ssh0.65.7 remote-ssh-edit0.65.7 azure-account0.9.8 hexeditor1.8.2 js-debug-nightly2021.9.417 live-server0.2.8 vscode-github-issue-notebooks0.0.106 vscode-typescript-next4.5. vsliveshare1.0.4836 debugger-for-chrome4.13.0 vetur0.34.1 java0.81.0 code-spell-checker2.0.4 rest-book4.2.0 ayu1.0.5 luna-paint0.9.0 sort-lines1.9.0 vscodeintellicode1.2.14 vscode-java-debug0.35.0 vscode-java-dependency0.18.7 vscode-java-test0.31.3 (2 theme extensions excluded) </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
I'm trying to document this command but find its behavior difficult to understand and rather unpredictable This could be wrong, but I think it tries looking for the next fold above the current level. In the case above, that means that works if you are inside another method: But it doesn't work if you are in the class body I'd expect this command to work more like where it just jumps to the next folded location in the file
FYI Got to next fold looks for the next fold of the same level. In the example above there's no such fold
Thanks for tagging me, The way I have fold jumping working is that it takes the cursor position and figures out what fold you are currently in. From there, it checks if you want the next previous or parent fold. Parent is pretty easy. It just gets the fold that's at level X - 1. For next and previous fold, they are implemented as the next or previous fold at the same level. The reason for that is because it makes it easy to find associated parts of the file. For example, if you are at an , , or fold, you can easily navigate to the other conditions. Similarly, in the above example, if you are on function , you can easily jump to the other functions that are defined. I don't think it's valuable to jump to the next or previous fold by file order. For example, in the below code it would not make sense to me to have jump to next fold go to b1, then c1, then c2, then a2. Please let me know if you want me to make any changes though.
We need a better label then: ?
That seems reasonable. Want me to do that? I probably shouldn't change the actually command ID though, right? That would break key bindings.
Thanks for the explanation. I agree that this should be renamed. Even with a better name though, I still find the behavior from my example confusing. When the cursor is inside the class body, I'd expect that the folding points for and would be siblings to the cursor's location (because they all have the same folding parent). Instead though we jump out of the class entirely
One other note on the name: maybe the command should call these something like instead of ? Conceptually I think of a as being code you've actually folded, but my understanding is that these commands actually jump between foldable lines in the file
sounds good to me. I see how that's confusing, so I put together this JS sample to illustrate where the "next fold" is for different cursor positions: Cursor 2's next is straightforward since you're on a folding point. Cursor 3's next I think is reasonable. You are in a fold, so you find the folding point and go to the next of that. Cursor 1 and 5's next start getting a little weird, but following the same logic as cursor 3, it seems logical that is the folding point, so the next sibling is at . Cursor 4 is basically your original question. I agree that it gets a little confusing. The logic is the same as 1, 3, and 5, but visually, if you're between 2 folding points, I could understand the desire for it to go to those points. I think the confusion stems from using the command when you're not on a folding point line. If you are, I think it's easy to understand, but when you aren't, not so much. What do you think of the following? If you are on a folding point line, do what it does now. not, go to the next folding point sequentially. With those updates, the above example looks like this:
We don't use 'folding points' as a term. I suggest 'folding range'
Ok. What do you think of changing the implementation as I mentioned in my previous comment?
Yes I like the suggestion (I thumbed up it :-) )
I wish I could turn on reaction notifications in GitHub. I implemented this in . I update the command from "Fold" to "Folding Region", but I did not add "Sibling". I hit a bit of a dilemma there. With the change, it's no longer necessarily a sibling. However, I can still see people getting confused by previous or next folding region command "not working" when you are on the first or last sibling folding region's start line. For example, in the above example, the previous command won't move you when you are at . I think that's really valuable. It lets you move up and down the different cases of branches without going past them. I wouldn't want to run previous at and end up at , then next brings me to . Any suggestions for that? I'm pretty sure nobody would want the command label to be "Go to Previous Folding Range, but Stop at First Sibling", but that's essentially what this does.
/verified Looks to follow the logic set out by I used this example: When on line 8 it jumps nowhere is a little confusing, but that's because the next folding range is the current?
That's because it's the last sibling. The benefit is that you can move to previous and next sibling folding ranges without stepping out of them (at which point going to the next or previous sibling won't be the original set of siblings you were on). I agree, it's confusing, but I think it's valuable to do it this way.

constructor() { super({ id: 'editor.gotoNextFold', <del> label: nls.localize('gotoNextFold.label', "Go to Next Fold"), alias: 'Go to Next Fold', </del> <ins> label: nls.localize('gotoNextFold.label', "Go to Next Folding Range"), alias: 'Go to Next Folding Range', </ins> precondition: CONTEXT_FOLDING_ENABLED, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus,


Question:
Issue Type: <bBug</ba JS file: Fold and place cursor after the opening of the class Bug Nothing happens VS Code version: Code - Insiders 1.61.0-insider (Universal) (, 2021-09-14T05:14:54.400Z) OS version: Darwin x64 20.6.0 Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ salesforce-soql-editor1.8.0 comment-tagged-templates0.3.1 docs-view0.0.9 emojisense0.9.0 folder-source-actions0.2.1 jsdoc-markdown-highlighting0.0.1 markdown-checkbox0.3.2 markdown-emoji0.2.1 markdown-yaml-preamble0.1.0 test-ext0.0.1 vscode-eslint2.1.25 typescript-notebook2.0.3 gitlens11.6.0 tsl-problem-matcher0.4.0 EditorConfig0.16.4 codespaces1.0.5 vscode-pull-request-github-insiders2021.9. vscode-drawio1.6.2 vscode-postfix-ts1.9.4 latex-workshop8.20.2 vscode-platform-specific-sample1.15.0 vscode-platform-specific-sample1.5.0 vscode-memfs0.0.3 template-string-converter0.5.3 vscode-azurefunctions1.5.1 vscode-azureresourcegroups0.4.0 vscode-docker1.16.1 vscode-language-pack-de1.60.3 vscode-edge-devtools1.3.0 python2021.10.-dev vscode-pylance2021.9.2-pre.1 jupyter2021.9. jupyter-keymap1.0.0 remote-containers0.194.0 remote-ssh0.65.7 remote-ssh-edit0.65.7 azure-account0.9.8 hexeditor1.8.2 js-debug-nightly2021.9.417 live-server0.2.8 vscode-github-issue-notebooks0.0.106 vscode-typescript-next4.5. vsliveshare1.0.4836 debugger-for-chrome4.13.0 vetur0.34.1 java0.81.0 code-spell-checker2.0.4 rest-book4.2.0 ayu1.0.5 luna-paint0.9.0 sort-lines1.9.0 vscodeintellicode1.2.14 vscode-java-debug0.35.0 vscode-java-dependency0.18.7 vscode-java-test0.31.3 (2 theme extensions excluded) </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
I'm trying to document this command but find its behavior difficult to understand and rather unpredictable This could be wrong, but I think it tries looking for the next fold above the current level. In the case above, that means that works if you are inside another method: But it doesn't work if you are in the class body I'd expect this command to work more like where it just jumps to the next folded location in the file
FYI Got to next fold looks for the next fold of the same level. In the example above there's no such fold
Thanks for tagging me, The way I have fold jumping working is that it takes the cursor position and figures out what fold you are currently in. From there, it checks if you want the next previous or parent fold. Parent is pretty easy. It just gets the fold that's at level X - 1. For next and previous fold, they are implemented as the next or previous fold at the same level. The reason for that is because it makes it easy to find associated parts of the file. For example, if you are at an , , or fold, you can easily navigate to the other conditions. Similarly, in the above example, if you are on function , you can easily jump to the other functions that are defined. I don't think it's valuable to jump to the next or previous fold by file order. For example, in the below code it would not make sense to me to have jump to next fold go to b1, then c1, then c2, then a2. Please let me know if you want me to make any changes though.
We need a better label then: ?
That seems reasonable. Want me to do that? I probably shouldn't change the actually command ID though, right? That would break key bindings.
Thanks for the explanation. I agree that this should be renamed. Even with a better name though, I still find the behavior from my example confusing. When the cursor is inside the class body, I'd expect that the folding points for and would be siblings to the cursor's location (because they all have the same folding parent). Instead though we jump out of the class entirely
One other note on the name: maybe the command should call these something like instead of ? Conceptually I think of a as being code you've actually folded, but my understanding is that these commands actually jump between foldable lines in the file
sounds good to me. I see how that's confusing, so I put together this JS sample to illustrate where the "next fold" is for different cursor positions: Cursor 2's next is straightforward since you're on a folding point. Cursor 3's next I think is reasonable. You are in a fold, so you find the folding point and go to the next of that. Cursor 1 and 5's next start getting a little weird, but following the same logic as cursor 3, it seems logical that is the folding point, so the next sibling is at . Cursor 4 is basically your original question. I agree that it gets a little confusing. The logic is the same as 1, 3, and 5, but visually, if you're between 2 folding points, I could understand the desire for it to go to those points. I think the confusion stems from using the command when you're not on a folding point line. If you are, I think it's easy to understand, but when you aren't, not so much. What do you think of the following? If you are on a folding point line, do what it does now. not, go to the next folding point sequentially. With those updates, the above example looks like this:
We don't use 'folding points' as a term. I suggest 'folding range'
Ok. What do you think of changing the implementation as I mentioned in my previous comment?
Yes I like the suggestion (I thumbed up it :-) )
I wish I could turn on reaction notifications in GitHub. I implemented this in . I update the command from "Fold" to "Folding Region", but I did not add "Sibling". I hit a bit of a dilemma there. With the change, it's no longer necessarily a sibling. However, I can still see people getting confused by previous or next folding region command "not working" when you are on the first or last sibling folding region's start line. For example, in the above example, the previous command won't move you when you are at . I think that's really valuable. It lets you move up and down the different cases of branches without going past them. I wouldn't want to run previous at and end up at , then next brings me to . Any suggestions for that? I'm pretty sure nobody would want the command label to be "Go to Previous Folding Range, but Stop at First Sibling", but that's essentially what this does.
/verified Looks to follow the logic set out by I used this example: When on line 8 it jumps nowhere is a little confusing, but that's because the next folding range is the current?
That's because it's the last sibling. The benefit is that you can move to previous and next sibling folding ranges without stepping out of them (at which point going to the next or previous sibling won't be the original set of siblings you were on). I agree, it's confusing, but I think it's valuable to do it this way.

*/ export function getPreviousFoldLine(lineNumber: number, foldingModel: FoldingModel): number | null { let foldingRegion = foldingModel.getRegionAtLine(lineNumber); <del> if (foldingRegion !== null) { </del> <ins> // If on the folding range start line, go to previous sibling. if (foldingRegion !== null && foldingRegion.startLineNumber === lineNumber) { </ins> // If current line is not the start of the current fold, go to top line of current fold. If not, go to previous fold. if (lineNumber !== foldingRegion.startLineNumber) { return foldingRegion.startLineNumber;


Question:
Issue Type: <bBug</ba JS file: Fold and place cursor after the opening of the class Bug Nothing happens VS Code version: Code - Insiders 1.61.0-insider (Universal) (, 2021-09-14T05:14:54.400Z) OS version: Darwin x64 20.6.0 Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ salesforce-soql-editor1.8.0 comment-tagged-templates0.3.1 docs-view0.0.9 emojisense0.9.0 folder-source-actions0.2.1 jsdoc-markdown-highlighting0.0.1 markdown-checkbox0.3.2 markdown-emoji0.2.1 markdown-yaml-preamble0.1.0 test-ext0.0.1 vscode-eslint2.1.25 typescript-notebook2.0.3 gitlens11.6.0 tsl-problem-matcher0.4.0 EditorConfig0.16.4 codespaces1.0.5 vscode-pull-request-github-insiders2021.9. vscode-drawio1.6.2 vscode-postfix-ts1.9.4 latex-workshop8.20.2 vscode-platform-specific-sample1.15.0 vscode-platform-specific-sample1.5.0 vscode-memfs0.0.3 template-string-converter0.5.3 vscode-azurefunctions1.5.1 vscode-azureresourcegroups0.4.0 vscode-docker1.16.1 vscode-language-pack-de1.60.3 vscode-edge-devtools1.3.0 python2021.10.-dev vscode-pylance2021.9.2-pre.1 jupyter2021.9. jupyter-keymap1.0.0 remote-containers0.194.0 remote-ssh0.65.7 remote-ssh-edit0.65.7 azure-account0.9.8 hexeditor1.8.2 js-debug-nightly2021.9.417 live-server0.2.8 vscode-github-issue-notebooks0.0.106 vscode-typescript-next4.5. vsliveshare1.0.4836 debugger-for-chrome4.13.0 vetur0.34.1 java0.81.0 code-spell-checker2.0.4 rest-book4.2.0 ayu1.0.5 luna-paint0.9.0 sort-lines1.9.0 vscodeintellicode1.2.14 vscode-java-debug0.35.0 vscode-java-dependency0.18.7 vscode-java-test0.31.3 (2 theme extensions excluded) </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
I'm trying to document this command but find its behavior difficult to understand and rather unpredictable This could be wrong, but I think it tries looking for the next fold above the current level. In the case above, that means that works if you are inside another method: But it doesn't work if you are in the class body I'd expect this command to work more like where it just jumps to the next folded location in the file
FYI Got to next fold looks for the next fold of the same level. In the example above there's no such fold
Thanks for tagging me, The way I have fold jumping working is that it takes the cursor position and figures out what fold you are currently in. From there, it checks if you want the next previous or parent fold. Parent is pretty easy. It just gets the fold that's at level X - 1. For next and previous fold, they are implemented as the next or previous fold at the same level. The reason for that is because it makes it easy to find associated parts of the file. For example, if you are at an , , or fold, you can easily navigate to the other conditions. Similarly, in the above example, if you are on function , you can easily jump to the other functions that are defined. I don't think it's valuable to jump to the next or previous fold by file order. For example, in the below code it would not make sense to me to have jump to next fold go to b1, then c1, then c2, then a2. Please let me know if you want me to make any changes though.
We need a better label then: ?
That seems reasonable. Want me to do that? I probably shouldn't change the actually command ID though, right? That would break key bindings.
Thanks for the explanation. I agree that this should be renamed. Even with a better name though, I still find the behavior from my example confusing. When the cursor is inside the class body, I'd expect that the folding points for and would be siblings to the cursor's location (because they all have the same folding parent). Instead though we jump out of the class entirely
One other note on the name: maybe the command should call these something like instead of ? Conceptually I think of a as being code you've actually folded, but my understanding is that these commands actually jump between foldable lines in the file
sounds good to me. I see how that's confusing, so I put together this JS sample to illustrate where the "next fold" is for different cursor positions: Cursor 2's next is straightforward since you're on a folding point. Cursor 3's next I think is reasonable. You are in a fold, so you find the folding point and go to the next of that. Cursor 1 and 5's next start getting a little weird, but following the same logic as cursor 3, it seems logical that is the folding point, so the next sibling is at . Cursor 4 is basically your original question. I agree that it gets a little confusing. The logic is the same as 1, 3, and 5, but visually, if you're between 2 folding points, I could understand the desire for it to go to those points. I think the confusion stems from using the command when you're not on a folding point line. If you are, I think it's easy to understand, but when you aren't, not so much. What do you think of the following? If you are on a folding point line, do what it does now. not, go to the next folding point sequentially. With those updates, the above example looks like this:
We don't use 'folding points' as a term. I suggest 'folding range'
Ok. What do you think of changing the implementation as I mentioned in my previous comment?
Yes I like the suggestion (I thumbed up it :-) )
I wish I could turn on reaction notifications in GitHub. I implemented this in . I update the command from "Fold" to "Folding Region", but I did not add "Sibling". I hit a bit of a dilemma there. With the change, it's no longer necessarily a sibling. However, I can still see people getting confused by previous or next folding region command "not working" when you are on the first or last sibling folding region's start line. For example, in the above example, the previous command won't move you when you are at . I think that's really valuable. It lets you move up and down the different cases of branches without going past them. I wouldn't want to run previous at and end up at , then next brings me to . Any suggestions for that? I'm pretty sure nobody would want the command label to be "Go to Previous Folding Range, but Stop at First Sibling", but that's essentially what this does.
/verified Looks to follow the logic set out by I used this example: When on line 8 it jumps nowhere is a little confusing, but that's because the next folding range is the current?
That's because it's the last sibling. The benefit is that you can move to previous and next sibling folding ranges without stepping out of them (at which point going to the next or previous sibling won't be the original set of siblings you were on). I agree, it's confusing, but I think it's valuable to do it this way.

if (foldingModel.regions.length > 0) { foldingRegion = foldingModel.regions.toRegion(foldingModel.regions.length - 1); while (foldingRegion !== null) { <del> // Found non-parent fold before current line. if (foldingRegion.parentIndex === -1 && foldingRegion.startLineNumber < lineNumber) { </del> <ins> // Found fold before current line. if (foldingRegion.startLineNumber < lineNumber) { </ins> return foldingRegion.startLineNumber; } if (foldingRegion.regionIndex > 0) {


Question:
Issue Type: <bBug</ba JS file: Fold and place cursor after the opening of the class Bug Nothing happens VS Code version: Code - Insiders 1.61.0-insider (Universal) (, 2021-09-14T05:14:54.400Z) OS version: Darwin x64 20.6.0 Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ salesforce-soql-editor1.8.0 comment-tagged-templates0.3.1 docs-view0.0.9 emojisense0.9.0 folder-source-actions0.2.1 jsdoc-markdown-highlighting0.0.1 markdown-checkbox0.3.2 markdown-emoji0.2.1 markdown-yaml-preamble0.1.0 test-ext0.0.1 vscode-eslint2.1.25 typescript-notebook2.0.3 gitlens11.6.0 tsl-problem-matcher0.4.0 EditorConfig0.16.4 codespaces1.0.5 vscode-pull-request-github-insiders2021.9. vscode-drawio1.6.2 vscode-postfix-ts1.9.4 latex-workshop8.20.2 vscode-platform-specific-sample1.15.0 vscode-platform-specific-sample1.5.0 vscode-memfs0.0.3 template-string-converter0.5.3 vscode-azurefunctions1.5.1 vscode-azureresourcegroups0.4.0 vscode-docker1.16.1 vscode-language-pack-de1.60.3 vscode-edge-devtools1.3.0 python2021.10.-dev vscode-pylance2021.9.2-pre.1 jupyter2021.9. jupyter-keymap1.0.0 remote-containers0.194.0 remote-ssh0.65.7 remote-ssh-edit0.65.7 azure-account0.9.8 hexeditor1.8.2 js-debug-nightly2021.9.417 live-server0.2.8 vscode-github-issue-notebooks0.0.106 vscode-typescript-next4.5. vsliveshare1.0.4836 debugger-for-chrome4.13.0 vetur0.34.1 java0.81.0 code-spell-checker2.0.4 rest-book4.2.0 ayu1.0.5 luna-paint0.9.0 sort-lines1.9.0 vscodeintellicode1.2.14 vscode-java-debug0.35.0 vscode-java-dependency0.18.7 vscode-java-test0.31.3 (2 theme extensions excluded) </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
I'm trying to document this command but find its behavior difficult to understand and rather unpredictable This could be wrong, but I think it tries looking for the next fold above the current level. In the case above, that means that works if you are inside another method: But it doesn't work if you are in the class body I'd expect this command to work more like where it just jumps to the next folded location in the file
FYI Got to next fold looks for the next fold of the same level. In the example above there's no such fold
Thanks for tagging me, The way I have fold jumping working is that it takes the cursor position and figures out what fold you are currently in. From there, it checks if you want the next previous or parent fold. Parent is pretty easy. It just gets the fold that's at level X - 1. For next and previous fold, they are implemented as the next or previous fold at the same level. The reason for that is because it makes it easy to find associated parts of the file. For example, if you are at an , , or fold, you can easily navigate to the other conditions. Similarly, in the above example, if you are on function , you can easily jump to the other functions that are defined. I don't think it's valuable to jump to the next or previous fold by file order. For example, in the below code it would not make sense to me to have jump to next fold go to b1, then c1, then c2, then a2. Please let me know if you want me to make any changes though.
We need a better label then: ?
That seems reasonable. Want me to do that? I probably shouldn't change the actually command ID though, right? That would break key bindings.
Thanks for the explanation. I agree that this should be renamed. Even with a better name though, I still find the behavior from my example confusing. When the cursor is inside the class body, I'd expect that the folding points for and would be siblings to the cursor's location (because they all have the same folding parent). Instead though we jump out of the class entirely
One other note on the name: maybe the command should call these something like instead of ? Conceptually I think of a as being code you've actually folded, but my understanding is that these commands actually jump between foldable lines in the file
sounds good to me. I see how that's confusing, so I put together this JS sample to illustrate where the "next fold" is for different cursor positions: Cursor 2's next is straightforward since you're on a folding point. Cursor 3's next I think is reasonable. You are in a fold, so you find the folding point and go to the next of that. Cursor 1 and 5's next start getting a little weird, but following the same logic as cursor 3, it seems logical that is the folding point, so the next sibling is at . Cursor 4 is basically your original question. I agree that it gets a little confusing. The logic is the same as 1, 3, and 5, but visually, if you're between 2 folding points, I could understand the desire for it to go to those points. I think the confusion stems from using the command when you're not on a folding point line. If you are, I think it's easy to understand, but when you aren't, not so much. What do you think of the following? If you are on a folding point line, do what it does now. not, go to the next folding point sequentially. With those updates, the above example looks like this:
We don't use 'folding points' as a term. I suggest 'folding range'
Ok. What do you think of changing the implementation as I mentioned in my previous comment?
Yes I like the suggestion (I thumbed up it :-) )
I wish I could turn on reaction notifications in GitHub. I implemented this in . I update the command from "Fold" to "Folding Region", but I did not add "Sibling". I hit a bit of a dilemma there. With the change, it's no longer necessarily a sibling. However, I can still see people getting confused by previous or next folding region command "not working" when you are on the first or last sibling folding region's start line. For example, in the above example, the previous command won't move you when you are at . I think that's really valuable. It lets you move up and down the different cases of branches without going past them. I wouldn't want to run previous at and end up at , then next brings me to . Any suggestions for that? I'm pretty sure nobody would want the command label to be "Go to Previous Folding Range, but Stop at First Sibling", but that's essentially what this does.
/verified Looks to follow the logic set out by I used this example: When on line 8 it jumps nowhere is a little confusing, but that's because the next folding range is the current?
That's because it's the last sibling. The benefit is that you can move to previous and next sibling folding ranges without stepping out of them (at which point going to the next or previous sibling won't be the original set of siblings you were on). I agree, it's confusing, but I think it's valuable to do it this way.

*/ export function getNextFoldLine(lineNumber: number, foldingModel: FoldingModel): number | null { let foldingRegion = foldingModel.getRegionAtLine(lineNumber); <del> if (foldingRegion !== null) { </del> <ins> // If on the folding range start line, go to next sibling. if (foldingRegion !== null && foldingRegion.startLineNumber === lineNumber) { </ins> // Find max line number to stay within parent. let expectedParentIndex = foldingRegion.parentIndex; let maxLineNumber = 0;


Question:
Issue Type: <bBug</ba JS file: Fold and place cursor after the opening of the class Bug Nothing happens VS Code version: Code - Insiders 1.61.0-insider (Universal) (, 2021-09-14T05:14:54.400Z) OS version: Darwin x64 20.6.0 Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ salesforce-soql-editor1.8.0 comment-tagged-templates0.3.1 docs-view0.0.9 emojisense0.9.0 folder-source-actions0.2.1 jsdoc-markdown-highlighting0.0.1 markdown-checkbox0.3.2 markdown-emoji0.2.1 markdown-yaml-preamble0.1.0 test-ext0.0.1 vscode-eslint2.1.25 typescript-notebook2.0.3 gitlens11.6.0 tsl-problem-matcher0.4.0 EditorConfig0.16.4 codespaces1.0.5 vscode-pull-request-github-insiders2021.9. vscode-drawio1.6.2 vscode-postfix-ts1.9.4 latex-workshop8.20.2 vscode-platform-specific-sample1.15.0 vscode-platform-specific-sample1.5.0 vscode-memfs0.0.3 template-string-converter0.5.3 vscode-azurefunctions1.5.1 vscode-azureresourcegroups0.4.0 vscode-docker1.16.1 vscode-language-pack-de1.60.3 vscode-edge-devtools1.3.0 python2021.10.-dev vscode-pylance2021.9.2-pre.1 jupyter2021.9. jupyter-keymap1.0.0 remote-containers0.194.0 remote-ssh0.65.7 remote-ssh-edit0.65.7 azure-account0.9.8 hexeditor1.8.2 js-debug-nightly2021.9.417 live-server0.2.8 vscode-github-issue-notebooks0.0.106 vscode-typescript-next4.5. vsliveshare1.0.4836 debugger-for-chrome4.13.0 vetur0.34.1 java0.81.0 code-spell-checker2.0.4 rest-book4.2.0 ayu1.0.5 luna-paint0.9.0 sort-lines1.9.0 vscodeintellicode1.2.14 vscode-java-debug0.35.0 vscode-java-dependency0.18.7 vscode-java-test0.31.3 (2 theme extensions excluded) </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
I'm trying to document this command but find its behavior difficult to understand and rather unpredictable This could be wrong, but I think it tries looking for the next fold above the current level. In the case above, that means that works if you are inside another method: But it doesn't work if you are in the class body I'd expect this command to work more like where it just jumps to the next folded location in the file
FYI Got to next fold looks for the next fold of the same level. In the example above there's no such fold
Thanks for tagging me, The way I have fold jumping working is that it takes the cursor position and figures out what fold you are currently in. From there, it checks if you want the next previous or parent fold. Parent is pretty easy. It just gets the fold that's at level X - 1. For next and previous fold, they are implemented as the next or previous fold at the same level. The reason for that is because it makes it easy to find associated parts of the file. For example, if you are at an , , or fold, you can easily navigate to the other conditions. Similarly, in the above example, if you are on function , you can easily jump to the other functions that are defined. I don't think it's valuable to jump to the next or previous fold by file order. For example, in the below code it would not make sense to me to have jump to next fold go to b1, then c1, then c2, then a2. Please let me know if you want me to make any changes though.
We need a better label then: ?
That seems reasonable. Want me to do that? I probably shouldn't change the actually command ID though, right? That would break key bindings.
Thanks for the explanation. I agree that this should be renamed. Even with a better name though, I still find the behavior from my example confusing. When the cursor is inside the class body, I'd expect that the folding points for and would be siblings to the cursor's location (because they all have the same folding parent). Instead though we jump out of the class entirely
One other note on the name: maybe the command should call these something like instead of ? Conceptually I think of a as being code you've actually folded, but my understanding is that these commands actually jump between foldable lines in the file
sounds good to me. I see how that's confusing, so I put together this JS sample to illustrate where the "next fold" is for different cursor positions: Cursor 2's next is straightforward since you're on a folding point. Cursor 3's next I think is reasonable. You are in a fold, so you find the folding point and go to the next of that. Cursor 1 and 5's next start getting a little weird, but following the same logic as cursor 3, it seems logical that is the folding point, so the next sibling is at . Cursor 4 is basically your original question. I agree that it gets a little confusing. The logic is the same as 1, 3, and 5, but visually, if you're between 2 folding points, I could understand the desire for it to go to those points. I think the confusion stems from using the command when you're not on a folding point line. If you are, I think it's easy to understand, but when you aren't, not so much. What do you think of the following? If you are on a folding point line, do what it does now. not, go to the next folding point sequentially. With those updates, the above example looks like this:
We don't use 'folding points' as a term. I suggest 'folding range'
Ok. What do you think of changing the implementation as I mentioned in my previous comment?
Yes I like the suggestion (I thumbed up it :-) )
I wish I could turn on reaction notifications in GitHub. I implemented this in . I update the command from "Fold" to "Folding Region", but I did not add "Sibling". I hit a bit of a dilemma there. With the change, it's no longer necessarily a sibling. However, I can still see people getting confused by previous or next folding region command "not working" when you are on the first or last sibling folding region's start line. For example, in the above example, the previous command won't move you when you are at . I think that's really valuable. It lets you move up and down the different cases of branches without going past them. I wouldn't want to run previous at and end up at , then next brings me to . Any suggestions for that? I'm pretty sure nobody would want the command label to be "Go to Previous Folding Range, but Stop at First Sibling", but that's essentially what this does.
/verified Looks to follow the logic set out by I used this example: When on line 8 it jumps nowhere is a little confusing, but that's because the next folding range is the current?
That's because it's the last sibling. The benefit is that you can move to previous and next sibling folding ranges without stepping out of them (at which point going to the next or previous sibling won't be the original set of siblings you were on). I agree, it's confusing, but I think it's valuable to do it this way.

if (foldingModel.regions.length > 0) { foldingRegion = foldingModel.regions.toRegion(0); while (foldingRegion !== null) { <del> // Found non-parent fold after current line. if (foldingRegion.parentIndex === -1 && foldingRegion.startLineNumber > lineNumber) { </del> <ins> // Found fold after current line. if (foldingRegion.startLineNumber > lineNumber) { </ins> return foldingRegion.startLineNumber; } if (foldingRegion.regionIndex < foldingModel.regions.length) {


Question:
Issue Type: <bBug</ba JS file: Fold and place cursor after the opening of the class Bug Nothing happens VS Code version: Code - Insiders 1.61.0-insider (Universal) (, 2021-09-14T05:14:54.400Z) OS version: Darwin x64 20.6.0 Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryExtensions (55)</summaryExtensionVersion ------ salesforce-soql-editor1.8.0 comment-tagged-templates0.3.1 docs-view0.0.9 emojisense0.9.0 folder-source-actions0.2.1 jsdoc-markdown-highlighting0.0.1 markdown-checkbox0.3.2 markdown-emoji0.2.1 markdown-yaml-preamble0.1.0 test-ext0.0.1 vscode-eslint2.1.25 typescript-notebook2.0.3 gitlens11.6.0 tsl-problem-matcher0.4.0 EditorConfig0.16.4 codespaces1.0.5 vscode-pull-request-github-insiders2021.9. vscode-drawio1.6.2 vscode-postfix-ts1.9.4 latex-workshop8.20.2 vscode-platform-specific-sample1.15.0 vscode-platform-specific-sample1.5.0 vscode-memfs0.0.3 template-string-converter0.5.3 vscode-azurefunctions1.5.1 vscode-azureresourcegroups0.4.0 vscode-docker1.16.1 vscode-language-pack-de1.60.3 vscode-edge-devtools1.3.0 python2021.10.-dev vscode-pylance2021.9.2-pre.1 jupyter2021.9. jupyter-keymap1.0.0 remote-containers0.194.0 remote-ssh0.65.7 remote-ssh-edit0.65.7 azure-account0.9.8 hexeditor1.8.2 js-debug-nightly2021.9.417 live-server0.2.8 vscode-github-issue-notebooks0.0.106 vscode-typescript-next4.5. vsliveshare1.0.4836 debugger-for-chrome4.13.0 vetur0.34.1 java0.81.0 code-spell-checker2.0.4 rest-book4.2.0 ayu1.0.5 luna-paint0.9.0 sort-lines1.9.0 vscodeintellicode1.2.14 vscode-java-debug0.35.0 vscode-java-dependency0.18.7 vscode-java-test0.31.3 (2 theme extensions excluded) </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
I'm trying to document this command but find its behavior difficult to understand and rather unpredictable This could be wrong, but I think it tries looking for the next fold above the current level. In the case above, that means that works if you are inside another method: But it doesn't work if you are in the class body I'd expect this command to work more like where it just jumps to the next folded location in the file
FYI Got to next fold looks for the next fold of the same level. In the example above there's no such fold
Thanks for tagging me, The way I have fold jumping working is that it takes the cursor position and figures out what fold you are currently in. From there, it checks if you want the next previous or parent fold. Parent is pretty easy. It just gets the fold that's at level X - 1. For next and previous fold, they are implemented as the next or previous fold at the same level. The reason for that is because it makes it easy to find associated parts of the file. For example, if you are at an , , or fold, you can easily navigate to the other conditions. Similarly, in the above example, if you are on function , you can easily jump to the other functions that are defined. I don't think it's valuable to jump to the next or previous fold by file order. For example, in the below code it would not make sense to me to have jump to next fold go to b1, then c1, then c2, then a2. Please let me know if you want me to make any changes though.
We need a better label then: ?
That seems reasonable. Want me to do that? I probably shouldn't change the actually command ID though, right? That would break key bindings.
Thanks for the explanation. I agree that this should be renamed. Even with a better name though, I still find the behavior from my example confusing. When the cursor is inside the class body, I'd expect that the folding points for and would be siblings to the cursor's location (because they all have the same folding parent). Instead though we jump out of the class entirely
One other note on the name: maybe the command should call these something like instead of ? Conceptually I think of a as being code you've actually folded, but my understanding is that these commands actually jump between foldable lines in the file
sounds good to me. I see how that's confusing, so I put together this JS sample to illustrate where the "next fold" is for different cursor positions: Cursor 2's next is straightforward since you're on a folding point. Cursor 3's next I think is reasonable. You are in a fold, so you find the folding point and go to the next of that. Cursor 1 and 5's next start getting a little weird, but following the same logic as cursor 3, it seems logical that is the folding point, so the next sibling is at . Cursor 4 is basically your original question. I agree that it gets a little confusing. The logic is the same as 1, 3, and 5, but visually, if you're between 2 folding points, I could understand the desire for it to go to those points. I think the confusion stems from using the command when you're not on a folding point line. If you are, I think it's easy to understand, but when you aren't, not so much. What do you think of the following? If you are on a folding point line, do what it does now. not, go to the next folding point sequentially. With those updates, the above example looks like this:
We don't use 'folding points' as a term. I suggest 'folding range'
Ok. What do you think of changing the implementation as I mentioned in my previous comment?
Yes I like the suggestion (I thumbed up it :-) )
I wish I could turn on reaction notifications in GitHub. I implemented this in . I update the command from "Fold" to "Folding Region", but I did not add "Sibling". I hit a bit of a dilemma there. With the change, it's no longer necessarily a sibling. However, I can still see people getting confused by previous or next folding region command "not working" when you are on the first or last sibling folding region's start line. For example, in the above example, the previous command won't move you when you are at . I think that's really valuable. It lets you move up and down the different cases of branches without going past them. I wouldn't want to run previous at and end up at , then next brings me to . Any suggestions for that? I'm pretty sure nobody would want the command label to be "Go to Previous Folding Range, but Stop at First Sibling", but that's essentially what this does.
/verified Looks to follow the logic set out by I used this example: When on line 8 it jumps nowhere is a little confusing, but that's because the next folding range is the current?
That's because it's the last sibling. The benefit is that you can move to previous and next sibling folding ranges without stepping out of them (at which point going to the next or previous sibling won't be the original set of siblings you were on). I agree, it's confusing, but I think it's valuable to do it this way.

assert.strictEqual(getPreviousFoldLine(9, foldingModel), 5); assert.strictEqual(getPreviousFoldLine(5, foldingModel), 3); assert.strictEqual(getPreviousFoldLine(3, foldingModel), null); <ins> // Test when not on a folding region start line. assert.strictEqual(getPreviousFoldLine(4, foldingModel), 3); assert.strictEqual(getPreviousFoldLine(7, foldingModel), 6); assert.strictEqual(getPreviousFoldLine(8, foldingModel), 6); </ins> // Test jump to next. assert.strictEqual(getNextFoldLine(3, foldingModel), 5); <del> assert.strictEqual(getNextFoldLine(4, foldingModel), 5); </del> assert.strictEqual(getNextFoldLine(5, foldingModel), 9); assert.strictEqual(getNextFoldLine(9, foldingModel), null); <ins> // Test when not on a folding region start line. assert.strictEqual(getNextFoldLine(4, foldingModel), 5); assert.strictEqual(getNextFoldLine(7, foldingModel), 9); assert.strictEqual(getNextFoldLine(8, foldingModel), 9); </ins> } finally { textModel.dispose();


Question:
This new capability allows the terminal to control when the tab description shows, so we can align the description in the terminal editor with how it shows up in a terminal panel tab.
To verify: Run a task, move the terminal to the editor area, check that the description shows up like it did in the panel In a terminal, change the directory, verify you see it in the tab description in the panel Move that to the terminal editor, make sure you see it there as well
Is this tooltip the task description? <img width="486" alt="image" src=""I think I'm a bit confused on how a task would be affected by a different terminal changing directories.
drag the terminal into the editor area and you should still see in the label of the tab.

} override get capabilities(): EditorInputCapabilities { <del> return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton | EditorInputCapabilities.CanDropIntoEditor; </del> <ins> return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton | EditorInputCapabilities.CanDropIntoEditor | EditorInputCapabilities.ForceDescription; </ins> } setTerminalInstance(instance: ITerminalInstance): void {


Question:
I just reloaded a window with my repo open, and it attached to a terminal which is already open in my repo, so now this terminal is open in two windows: ! The right window is the window that originally owned this terminal One thing about this terminal is that its cwd is some other folder outside of both workspaces, if that matters.
I reloaded the left window again, and it reattached to the correct terminal. !
Just so you know, this happens pretty often. I just reloaded a window and got some random terminal from another window. Let me know if I can collect any other info
Also hit this, I believe it was after restarting insiders for an update. !
I was able to repro once out of many attempts. I wonder if there's a command to reload all windows to simulate what happens on update? Maybe then I'd see it?
exiting the application (cmd+q) and reopening it is essentially what happens on update
Something similar just happened with the most recent insiders update, but now the terminals aren't synced, it's just that the working directory of one window's terminal is set to the other window's root instead of it's own. <img width="1440" alt="image" src="https://user-"
Happened again, accidentally ran a destructive command in the wrong directory :( cc is there any logging or something I can enable to help you get to the bottom of this?
I spent awhile investigating. I don't understand what could be going on here because we store and reconnect to terminals according to the workspaceId. said that he thinks it's a race condition. Setting log level to trace and toggling the shared process would help when it reproes
Today I had something new happen: had 3 VS Code windows open. reloaded window 1. 1 now shares a terminal with window 3! Totally different workspaces. No other windows were reloaded. No windows were closed. Is there a way I can disable terminal reconnect for local windows? I've also run destructive commands when this happens and I don't want to risk it.
Yep, it's not working atm for remote terminals, so:
Hello everyone, there is any plan to try to fix it in the nearest milestone?
This code that we for transferring terminals via dnd between windows looks suspicious
Has anyone seen this in awhile? I cannot reproduce
I don't remember seeing it recently
Okay pls reopen if you see it again and I'll be happy to debug with anyone that can reproduce it
Sorry, I cursed myself because this happened again today but I probably won't have consistent repro steps. I reloaded the window with my vscode workspace and got a terminal from this extension sample which is also open in another window, although the terminal panel had not been made visible in that other window's session yet. I reloaded the window several more times and always got the right terminal after that. <img width="1049" alt="image" src="https://user-"
we don't create a terminal until you open the panel, so what do you mean by the terminal had not been made visible yet?
In case it is important to the issue, I'm just saying that the drop-on-document terminal that was wrongly attached to the vscode window hadn't yet been attached to the drop-on-document window, because it was from some earlier session.
I also used to see this periodically but I've had terminal reattach disabled to avoid it. Let me know if it will be helpful and I'll re-enable reattach!
Same as
Yes it would be very helpful I spent 90 mins yesterday trying to reproduce to no avail. If you could enable trace logging too in case you repro, that might give the insight we need
We should review the code around terminal adoption of orphan processes, I suspect the issue is that it's not transactional.
it appears we're only doing an orphan check on terminals that are in the workspace as set in the map
I think somewhere all unadopted processes get taken by some window? Might not be remembering right though.
If you see this again after lands, please enable trace logging and get the output channel logs for Pty Host and Window.
I was seeing this previously on occasion but haven't seen it over the last week so marking as verified
+1 on no longer seeing it since re-enabling re-attach a few weeks ago.
Just saw this again. The incorrect re-attach occurred on 1 July and I only noticed it today. Pty logs: Window logs
This seemed for a while like it'd stopped happening, but just ran into it again: In my case I'd just reloaded a single window.
Just had this happen again, but once again I didn't have trace logging on. I'll try to leave it turned on for next time. Pty Host logs: Window logs:
Could the needed log statement to troubleshoot this on the terminal side be converted to an log. That might help track down this bug sooner.
they're actually warnings already so they should show up:
Just ran into this again. I have the same terminal restored in two distinct windows. I ran into this after restarting to update Insiders on macOS (I had 6 folders opened). The Pty Host log contains the following: https://user- Maybe might know if there's a way to easily simulate a restart caused by an update. Alternatively, maybe you can try changing a setting like which shows the restart prompt. I think this also leads to the terminals attaching incorrectly.
Might be related to (maybe not as that's remote only?)
this is a little confusing to me. No reconnect is meant to happen on restart, when updating node-pty gets replaced so it can't be running, all processes are torn down and the pty host shuts down with the main process. Did you see this? !
Changing this to always return isOrphan = true: I can get it to reconnect which is meant to be prevented by one of my other changes.
It's a little suspicious that the entry doesn't get deleted: That determines here which can bypass the orphan check:
I can confirm that within the last two days (both before and after the upgrade to 1.70.0) it has happened to me both on window reload and on full VSCode restart.
When I see this it also happen on restart.
do you see the history restored message when it happens on restart?
Yes, I see this every time when restarting to install a new version (Gear Restart to Update) or when changing the setting : <img width="473" alt="image" src="https://user-"
I'm 99.9% certain the answer is yes, but I will make sure to notice the next time it happens.
Ok, I figured this out. What a journey! Here is the fairly reliable repro: Clear state - Given 2 folders and Open folders and and close all terminals File Exit Setup for the process revive - Window : Open 3 terminals and type "a", "b", "c" into them respectively, this helps identify them to ensure they're in the correct order later Window : Open 3 terminals and type "d", "e", "f" into them respectively File Exit Process revive - Window and should revive the processes and have all terminals in the correct order they were created (this works) Process reconnect Reload window and window at the same time Window and should revive the processes and have all terminals in the correct order they were created :bug: Note that this is a timing issue and has a chance to not reproduce the problem. This is what is meant to happen when exiting and restarting the pty host process. Terminal processes are revived (aka. re-created) and their actual pty IDs for this pty host process are mapped to, starting at 1. Notice below how the new IDs start from 1, they just represent the order they are created in which shouldn't matter when reviving. After that, when reloading windows, terminal processes do not get revived but reconnected to. So an mapping is expected: What is happening and what is causing this bug as well as a related issue[^1] is that the revived pty ID is cached, so if reloading happens to use a that is mapped to a different pty ID in , it will reconnect to that one instead: The above results in: Then on reload the pty ID mapping occurs instead of being undefined, which causes a reconnect_ to the wrong pty. So in the above they get re-mapped, shuffling the order within a window and potentially connecting to a different window's ptys: ! [^1]: The folder's terminals may not get restored at with the warning "Couldn't get layout info, a terminal was probably disconnected" in the pty host output channel. This started happening due to one of the previous workarounds to prevent 2 windows attaching to the same pty.
Wow. Nice detective work! Thanks, looking forward to the fix.
Reported here
I actually saw it again once earlier this week too. It does seem to happen significantly less often than it used to.
I just ran into this again today. After a restart due to an update, I got a terminal from a folder showing up by itself in folder . Here's the only relevant content I found in my logs:
I hit this today. Moving this forward to January 2023, since it probably was just lost in the queries by being assigned to August 2022.
I've hit this once per day for the past several days. It seems to be occurring more frequently again.
This would probably be addressed if terminals moved into utility process and there was a message port per terminal:
Using the new pty host trace logging, this is what happens on a reload with a single terminal that will be reconnected, with the environment parts truncated:
I believe this is now fixed as a part of I'm still not able to reproduce but the current theory is that the async isOrphan check that was removed in the PR was not only delaying reconnection by 4 seconds, but also causing a race where the wrong window could adopt it. Instead we no longer check whether it's an orphan and trust the saved workplace state to be correct.
Thanks for following up
I haven't seen this in a long time. Not sure whether there is anything that can be done to verify it.
I just ran into this now: had ~4 windows open: Window 1 is vscode-pull-request-github2 : terminals cwd were all in the workspace Window 2 is vscode-pull-request-github: terminals cwd were all in the workspace Window 3 is repo1: 2 terminals, both of which had a cwd outside the workspace Window 4 is vscode: terminals cwd were all in the workspace VS Code reattach: Window 1's terminals are correct Window 2 has reattached to one of Window 3's terminals and has lost it's original terminal Window 3's terminals are correct Window 4's terminals are correct. Pty logs from Window 2:
thanks for the info! Looking into it
I spent a few hours looking into this, here are my findings: This warning in the logs is common across recent failures: , I tried and tried but could not reproduce this on Insiders or OSS I'm adding more verbose logs to the info log level that gives me the old/new pty id mapping as well as dumping a bunch of info when the above error happens I looked into whether should be correct and while I found it could cause issues when the pty host restarts (), it seems like it should work after a restart I could the cwd being outside the workspace would make a difference as we don't even take that into account when reviving the proc () The management of would be a lot simpler if we moved the id to being a guid instead of a number, but that would be a shame as we then need to send the guid along the wire for pretty much every request to the pty host I looked into possible race conditions where could get stale/invalid values. Both a thorough review of the code and injecting timeouts (random, differing by window) into important calls didn't cause problems Current plan is to wait for to merge and await a repro with these logs present, then analyze them. I'll also likely be continuing to fiddle with terminal reconnection in debt week to improve perf further and reduce redundancies.
I'll keep an eye out for this and try to maintain a setup similar that one that I just saw it with, but I have to say, this has gotten so much better. I almost never see it.
I tried to repeat my setup before updating, and it did happen again. Setup: Window 1 is vscode-pull-request-github2 : terminal cwd is outside the workspace and on a different drive (C vs D) Window 2 is vscode-pull-request-github: terminals cwd were in the workspace Window 3 is repo1: terminal cws was in the workspace Window 4 is vscode: terminals cwd were all in the workspace After update: Window 1 is vscode-pull-request-github2 : has a new terminal Window 2 is vscode-pull-request-github: correct Window 3 is repo1: has attached to Window 2's terminal and now they share the same terminal Window 4 is vscode: correct Logs:
Thanks it seems there's some inconsistency with the layout info and the revived procs, so I suspect this silently error swallowing now: Added logs for that here: , I'll merge for July so you might not be able to test for a week but when you do please also grab the Terminal output log as this is renderer side.
Cross post
With logs in , I was able to reproduce the problem! ! The repro is very complicated, it is essentially trying to get into a state where 2+ windows have "old pty ids" that conflict with one another, and then increasing the latency of the pty host in order to force the race condition to show itself. these settings: default log level to trace all windows window 1 (W1) with folder A 1: Open 2 terminals 1: Close window 1: Open window 1: Open pty host log, you should see this: window 2 (W2) with folder B 2: Open 2 terminals 1: Close window 2: Close window VS Code (W2 should open) 2: Open pty host log, you should something like this: 2: Close window an external terminal and type another external terminal and type the commands in both terminals in quick succession 1|W2: Open pty host log, you should see something like this: The terminal with end up attaching to the wrong pty. The fix for this is simple, just add workspace ID as part of the key of the old id, so becomes . This should make conflicts impossible to occur.

async attachToProcess(id: number): Promise<void> { try { <del> this._throwIfNoPty(id).attach(); </del> <ins> await this._throwIfNoPty(id).attach(); </ins> this._logService.trace(`Persistent process reconnection "${id}"`); } catch (e) { this._logService.trace(`Persistent process reconnection "${id}" failed`, e.message); <ins> throw e; </ins> } }