Skip to content

Commit

Permalink
wip-bitbake-terminal-profile
Browse files Browse the repository at this point in the history
  • Loading branch information
deribaucourt committed Jan 5, 2024
1 parent 4105bb3 commit 1a8dc5e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,14 @@
"when": "viewItem == devtoolWorskpaceCtx"
}
]
},
"terminal": {
"profiles": [
{
"id": "bitbake.terminal",
"title": "bitbake"
}
]
}
},
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { BitBakeProjectScanner } from './driver/BitBakeProjectScanner'
import { BitbakeDocumentLinkProvider } from './documentLinkProvider'
import { DevtoolWorkspacesView } from './ui/DevtoolWorkspacesView'
import { bitbakeESDKMode, setBitbakeESDKMode } from './driver/BitbakeESDK'
import { BitbakeTerminalProfileProvider } from './ui/BitbakeTerminalProfile'

let client: LanguageClient
const bitbakeDriver: BitbakeDriver = new BitbakeDriver()
Expand All @@ -29,6 +30,7 @@ export let bitbakeExtensionContext: vscode.ExtensionContext
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let bitbakeRecipesView: BitbakeRecipesView | undefined
let devtoolWorkspacesView: DevtoolWorkspacesView | undefined
let terminalProvider: BitbakeTerminalProfileProvider | undefined

function loadLoggerSettings (): void {
logger.level = vscode.workspace.getConfiguration('bitbake').get('loggingLevel') ?? 'info'
Expand Down Expand Up @@ -84,6 +86,8 @@ export async function activate (context: vscode.ExtensionContext): Promise<void>
void vscode.commands.executeCommand('setContext', 'bitbake.active', true)
const bitbakeStatusBar = new BitbakeStatusBar(bitBakeProjectScanner)
context.subscriptions.push(bitbakeStatusBar.statusBarItem)
terminalProvider = new BitbakeTerminalProfileProvider(bitbakeDriver)
vscode.window.registerTerminalProfileProvider('bitbake.terminal', terminalProvider)

const provider = new BitbakeDocumentLinkProvider(client)
const selector = { scheme: 'file', language: 'bitbake' }
Expand Down
27 changes: 27 additions & 0 deletions client/src/ui/BitbakeTerminalProfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) 2023 Savoir-faire Linux. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import type * as vscode from 'vscode'
import { BitbakePseudoTerminal } from './BitbakeTerminal'
import { type BitbakeDriver } from '../driver/BitbakeDriver'

export class BitbakeTerminalProfileProvider implements vscode.TerminalProfileProvider {
private readonly bitbakeDriver: BitbakeDriver

constructor (bitbakeDriver: BitbakeDriver) {
this.bitbakeDriver = bitbakeDriver
}

provideTerminalProfile (token: vscode.CancellationToken): vscode.ProviderResult<vscode.TerminalProfile> {
const pty = new BitbakePseudoTerminal(this.bitbakeDriver)
pty.runProcess('bash') // let the fun begin!

Check failure on line 19 in client/src/ui/BitbakeTerminalProfile.ts

View workflow job for this annotation

GitHub Actions / build (20)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
return {
options: {
name: 'Bitbake',
pty
} satisfies vscode.ExtensionTerminalOptions
}
}
}

0 comments on commit 1a8dc5e

Please sign in to comment.