Skip to content

Commit

Permalink
Fixed language change detection of detached body panes
Browse files Browse the repository at this point in the history
  • Loading branch information
boltex committed May 14, 2024
1 parent 38aa830 commit 789681c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion leoInteg.leo
Original file line number Diff line number Diff line change
Expand Up @@ -5801,7 +5801,7 @@ public static TCPIP_DEFAULT_PROTOCOL: string = "ws://";
public static ERROR_PACKAGE_ID: number = 0;
public static STARTING_PACKAGE_ID: number = 1;
public static CLEANUP_DEBOUNCE_DELAY: number = 40;
public static DETACHED_LANGUAGE_DELAY: number = 350;
public static DETACHED_LANGUAGE_DELAY: number = 300;
public static DOCUMENTS_DEBOUNCE_DELAY: number = 80;
public static BUTTONS_DEBOUNCE_DELAY: number = 80;
public static UNDOS_DEBOUNCE_DELAY: number = 180;
Expand Down Expand Up @@ -21698,6 +21698,7 @@ public _onTabsChanged(p_event: vscode.TabChangeEvent): void {
const q_foundResults: Array<Promise<LeoBridgePackage>> = [];
const w_sentFoundTabs: Array<vscode.Tab> = [];
const w_sentFoundUri: Array<vscode.Uri> = [];
let w_hasDetached = false;

for (const p_tabGroup of vscode.window.tabGroups.all) {
for (const p_tab of p_tabGroup.tabs) {
Expand All @@ -21712,6 +21713,7 @@ public _onTabsChanged(p_event: vscode.TabChangeEvent): void {
if (!this._refreshType.excludeDetached && this._refreshType.body && id === c_id) {
// console.log('fire refresh DETACHED in _refreshDetachedBodies');
this._leoDetachedFileSystem.fireRefreshFile(`${id}/${gnx}`);
w_hasDetached = true;
}

// if refresh tree is true, validate that opened detached of same commander still valid and close as needed.
Expand Down Expand Up @@ -21748,6 +21750,9 @@ public _onTabsChanged(p_event: vscode.TabChangeEvent): void {

}
}
if (w_hasDetached && this._refreshType.tree) {
this.refreshCommanderDetachedLanguage(); // May have moved outside of language specific outline
}
this._refreshType.excludeDetached = false;

if (q_foundResults.length) {
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Constants {
public static ERROR_PACKAGE_ID: number = 0;
public static STARTING_PACKAGE_ID: number = 1;
public static CLEANUP_DEBOUNCE_DELAY: number = 40;
public static DETACHED_LANGUAGE_DELAY: number = 350;
public static DETACHED_LANGUAGE_DELAY: number = 300;
public static DOCUMENTS_DEBOUNCE_DELAY: number = 80;
public static BUTTONS_DEBOUNCE_DELAY: number = 80;
public static UNDOS_DEBOUNCE_DELAY: number = 180;
Expand Down
5 changes: 5 additions & 0 deletions src/leoIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2743,6 +2743,7 @@ export class LeoIntegration {
const q_foundResults: Array<Promise<LeoBridgePackage>> = [];
const w_sentFoundTabs: Array<vscode.Tab> = [];
const w_sentFoundUri: Array<vscode.Uri> = [];
let w_hasDetached = false;

for (const p_tabGroup of vscode.window.tabGroups.all) {
for (const p_tab of p_tabGroup.tabs) {
Expand All @@ -2757,6 +2758,7 @@ export class LeoIntegration {
if (!this._refreshType.excludeDetached && this._refreshType.body && id === c_id) {
// console.log('fire refresh DETACHED in _refreshDetachedBodies');
this._leoDetachedFileSystem.fireRefreshFile(`${id}/${gnx}`);
w_hasDetached = true;
}

// if refresh tree is true, validate that opened detached of same commander still valid and close as needed.
Expand Down Expand Up @@ -2793,6 +2795,9 @@ export class LeoIntegration {

}
}
if (w_hasDetached && this._refreshType.tree) {
this.refreshCommanderDetachedLanguage(); // May have moved outside of language specific outline
}
this._refreshType.excludeDetached = false;

if (q_foundResults.length) {
Expand Down

0 comments on commit 789681c

Please sign in to comment.