Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c072326

Browse files
authored
Allow to close files in certain folders (#946)
* Allow to close files in certain folders * Only direct children are sketch files
1 parent 58e992a commit c072326

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎arduino-ide-extension/src/browser/theia/core/application-shell.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { Sketch } from '../../../common/protocol';
1717
import { SaveAsSketch } from '../../contributions/save-as-sketch';
1818
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
1919
import { nls } from '@theia/core/lib/common';
20+
import URI from '@theia/core/lib/common/uri';
2021

2122
@injectable()
2223
export class ApplicationShell extends TheiaApplicationShell {
@@ -41,6 +42,9 @@ export class ApplicationShell extends TheiaApplicationShell {
4142
// Make the editor un-closeable asynchronously.
4243
this.sketchesServiceClient.currentSketch().then((sketch) => {
4344
if (sketch) {
45+
if (!this.isSketchFile(widget.editor.uri, sketch.uri)) {
46+
return;
47+
}
4448
if (Sketch.isInSketch(widget.editor.uri, sketch)) {
4549
widget.title.closable = false;
4650
}
@@ -49,6 +53,14 @@ export class ApplicationShell extends TheiaApplicationShell {
4953
}
5054
}
5155

56+
private isSketchFile(uri: URI, sketchUriString: string): boolean {
57+
const sketchUri = new URI(sketchUriString);
58+
if (uri.parent.isEqual(sketchUri)) {
59+
return true;
60+
}
61+
return false;
62+
}
63+
5264
async addWidget(
5365
widget: Widget,
5466
options: Readonly<TheiaApplicationShell.WidgetOptions> = {}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /