mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-06 04:06:32 +00:00
make sure the sketch file has the focus after the ws open.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
87b383f57e
commit
fdc5814e66
@ -267,6 +267,9 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
|
|||||||
for (const uri of uris) {
|
for (const uri of uris) {
|
||||||
await this.editorManager.open(new URI(uri));
|
await this.editorManager.open(new URI(uri));
|
||||||
}
|
}
|
||||||
|
if (uris.length) {
|
||||||
|
await this.editorManager.open(new URI(uris[0])); // Make sure the sketch file has the focus.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registerColors(colors: ColorRegistry): void {
|
registerColors(colors: ColorRegistry): void {
|
||||||
|
@ -63,13 +63,19 @@ export class SketchesServiceImpl implements SketchesService, BackendApplicationC
|
|||||||
const fsPath = FileUri.fsPath(uri);
|
const fsPath = FileUri.fsPath(uri);
|
||||||
if (fs.lstatSync(fsPath).isDirectory()) {
|
if (fs.lstatSync(fsPath).isDirectory()) {
|
||||||
if (await this.isSketchFolder(uri)) {
|
if (await this.isSketchFolder(uri)) {
|
||||||
|
const basename = path.basename(fsPath)
|
||||||
const fileNames = await fs.readdir(fsPath);
|
const fileNames = await fs.readdir(fsPath);
|
||||||
for (const fileName of fileNames) {
|
for (const fileName of fileNames) {
|
||||||
const filePath = path.join(fsPath, fileName);
|
const filePath = path.join(fsPath, fileName);
|
||||||
if (ALLOWED_FILE_EXTENSIONS.indexOf(path.extname(filePath)) !== -1
|
if (ALLOWED_FILE_EXTENSIONS.indexOf(path.extname(filePath)) !== -1
|
||||||
&& fs.existsSync(filePath)
|
&& fs.existsSync(filePath)
|
||||||
&& fs.lstatSync(filePath).isFile()) {
|
&& fs.lstatSync(filePath).isFile()) {
|
||||||
uris.push(FileUri.create(filePath).toString())
|
const uri = FileUri.create(filePath).toString();
|
||||||
|
if (fileName === basename + '.ino') {
|
||||||
|
uris.unshift(uri);
|
||||||
|
} else {
|
||||||
|
uris.push(uri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user