Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompletion bento config tests #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bentoml",
"publisher": "mlops-club",
"version": "0.0.8",
"version": "0.1.0",
"displayName": "BentoML",
"icon": "src/resources/bentoml-logo.png",
"author": {
Expand Down Expand Up @@ -58,6 +58,13 @@
"**/*bentofile.yml"
],
"url": "./src/resources/yamlSchemas/bentofileSchema.out.json"
},
{
"fileMatch": [
"**/*bento_config*.yaml",
"**/*bento_config*.yml"
],
"url": "./src/resources/yamlSchemas/bentoConfigurationSchema.out.json"
}
],
"configuration": {
Expand Down
73 changes: 39 additions & 34 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,46 +205,51 @@ export async function activate(context: vscode.ExtensionContext) {
}
});

let dependencyInstallationDisposable = vscode.commands.registerCommand(`${consts.EXTENSION_ID}.installPythonDependencies`, async () => {
// The code you place here will be executed every time your command is executed
await ensureBentoMlCliIsAvailable();
vscode.window.showInformationMessage(`[${consts.EXTENSION_NAME}] Python dependencies installed successfully!`);
});
let dependencyInstallationDisposable = vscode.commands.registerCommand(
`${consts.EXTENSION_ID}.installPythonDependencies`,
async () => {
// The code you place here will be executed every time your command is executed
await ensureBentoMlCliIsAvailable();
vscode.window.showInformationMessage(`[${consts.EXTENSION_NAME}] Python dependencies installed successfully!`);
}
);
context.subscriptions.push(dependencyInstallationDisposable);

let homeDirOpeningDisposable = vscode.commands.registerCommand(`${consts.EXTENSION_ID}.openBentomlHomeDir`, async () => {
const extensionConfig = vscode.workspace.getConfiguration();

const homeDir = os.homedir();
const bentomlDirPath = extensionConfig.get<string>('bentoml.bentomlHomeDir') || "bentoml";
const bentomlDir = path.resolve(homeDir, bentomlDirPath);
console.log(`bentomlDir: ${bentomlDir}`);
let homeDirOpeningDisposable = vscode.commands.registerCommand(
`${consts.EXTENSION_ID}.openBentomlHomeDir`,
async () => {
const extensionConfig = vscode.workspace.getConfiguration();

try {
const bentomlDirUri = vscode.Uri.file(bentomlDir);
const bentomlWorkspaceFolder: vscode.WorkspaceFolder = {
uri: bentomlDirUri,
name: 'bentoml-home-directory', // Optional
index: 0
};
const homeDir = os.homedir();
const bentomlDirPath = extensionConfig.get<string>('bentoml.bentomlHomeDir') || 'bentoml';
const bentomlDir = path.resolve(homeDir, bentomlDirPath);
console.log(`bentomlDir: ${bentomlDir}`);

const currentFolders = vscode.workspace.workspaceFolders ?? [];
const allFolders: vscode.WorkspaceFolder[] = [...currentFolders, bentomlWorkspaceFolder];
for (const folder of allFolders) {
console.log(`folder URI (before): ${folder.uri}`);
}
const added: boolean = vscode.workspace.updateWorkspaceFolders(0, 1, ...allFolders);
console.log(`Added? ${added}`);
const newCurrentFolders = vscode.workspace.workspaceFolders ?? [];
for (const folder of newCurrentFolders) {
console.log(`folder URI (after): ${folder.uri}`);
try {
const bentomlDirUri = vscode.Uri.file(bentomlDir);
const bentomlWorkspaceFolder: vscode.WorkspaceFolder = {
uri: bentomlDirUri,
name: 'bentoml-home-directory', // Optional
index: 0,
};

const currentFolders = vscode.workspace.workspaceFolders ?? [];
const allFolders: vscode.WorkspaceFolder[] = [...currentFolders, bentomlWorkspaceFolder];
for (const folder of allFolders) {
console.log(`folder URI (before): ${folder.uri}`);
}
const added: boolean = vscode.workspace.updateWorkspaceFolders(0, 1, ...allFolders);
console.log(`Added? ${added}`);
const newCurrentFolders = vscode.workspace.workspaceFolders ?? [];
for (const folder of newCurrentFolders) {
console.log(`folder URI (after): ${folder.uri}`);
}
} catch (error) {
console.error('Error opening BentoML home directory:', error);
vscode.window.showErrorMessage('Error opening BentoML home directory');
}
} catch (error) {
console.error('Error opening BentoML home directory:', error);
vscode.window.showErrorMessage('Error opening BentoML home directory');
}

});
);
context.subscriptions.push(homeDirOpeningDisposable);

// notify the user that the extension activated successfully
Expand Down
Loading
Loading