Skip to content

Commit

Permalink
chore: .eidtorconfig maxline code
Browse files Browse the repository at this point in the history
  • Loading branch information
giscafer committed Aug 18, 2020
1 parent aa6e2cf commit a390fb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single
max_line_length = 140
max_line_length = 120

[*.md]
insert_final_newline = false
Expand Down
18 changes: 3 additions & 15 deletions src/ReusedWebviewPanel.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
window,
ViewColumn,
WebviewPanel,
WebviewPanelOptions,
WebviewOptions,
} from "vscode";
import { window, ViewColumn, WebviewPanel, WebviewPanelOptions, WebviewOptions } from 'vscode';

module ReusedWebviewPanel {
const webviewPanelsPool: Map<string, WebviewPanel> = new Map(); // webviewPanel池
Expand All @@ -30,17 +24,12 @@ module ReusedWebviewPanel {
return oldPanel;
}

const newPanel = window.createWebviewPanel(
viewType,
title,
showOptions,
options
);
const newPanel = window.createWebviewPanel(viewType, title, showOptions, options);

newPanel.onDidDispose(() => webviewPanelsPool.delete(viewType));
webviewPanelsPool.set(viewType, newPanel);

console.log("webviewPanelsPool.size:", webviewPanelsPool.size);
console.log('webviewPanelsPool.size:', webviewPanelsPool.size);

return newPanel;
}
Expand All @@ -54,7 +43,6 @@ module ReusedWebviewPanel {

if (target) {
webviewPanelsPool.delete(viewType);

// createWebviewPanel是异步的,setTimeout避免创建未完成时调用dispose报错
setTimeout(() => target.dispose(), 0);
}
Expand Down

0 comments on commit a390fb8

Please sign in to comment.