Skip to content

Commit

Permalink
fix issue with packaging
Browse files Browse the repository at this point in the history
some cleanup
  • Loading branch information
Gerhard Brueckl committed Jul 28, 2022
1 parent 3bdcd10 commit 04b84df
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 63 deletions.
5 changes: 3 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.vscode/**
.vscode-test/**
node_modules/**
out/test/**
test/**
src/**
**/*.map
.gitignore
tsconfig.json
*.code-workspace
*lint.json
src/
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.

14 changes: 2 additions & 12 deletions src/ThisExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { SensitiveValueStore } from './vscode/treeviews/connections/_types';
import { DatabricksConnectionTreeItem } from './vscode/treeviews/connections/DatabricksConnectionTreeItem';
import { DatabricksConnectionManagerCLI } from './vscode/treeviews/connections/DatabricksConnectionManagerCLI';
import { DatabricksKernel } from './vscode/notebook/DatabricksKernel';
import { Dictionary } from 'form-data';

// https://vshaxe.github.io/vscode-extern/vscode/TreeDataProvider.html
export abstract class ThisExtension {
Expand Down Expand Up @@ -188,17 +187,8 @@ export abstract class ThisExtension {
}

static async getSecureSetting(setting: string): Promise<string> {
let value = this.secrets.get(setting); // new way to store secrets

// check if the new secret is not yet set/used
if(await value == undefined)
{
let _keytar = require('keytar');
// get old value and store it the new way
value = _keytar.getPassword(this.configuration.id, setting);
await this.setSecureSetting(setting, await value);
}

let value = this.secrets.get(setting);

return value;
}

Expand Down
47 changes: 0 additions & 47 deletions src/helpers/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,53 +275,6 @@ export abstract class Helper {
});
}

static async addCodeCells(filePath: string): Promise<void> {
try {
const replace = require('replace-in-file');
let regex = new RegExp(this.DatabricksCommandTagRegEx, 'g');
let options = {
files: filePath,
from: regex,
to: this.DatabricksCommandTagRegEx + '\n' + this.CodeCellTag
};


let results = await replace(options);
ThisExtension.log('Replacement results:', results[0].hasChanged);

// remove duplicat code cells that might have been added
regex = new RegExp(this.CodeCellTag + '[\\r\\n]' + this.CodeCellTag, 'g');
options = {
files: filePath,
from: regex,
to: this.CodeCellTag
};

results = await replace(options);
ThisExtension.log('Replacement results:', results[0].hasChanged);
}
catch (error) {
ThisExtension.log('Error occurred:', error);
}
}
static async removeCodeCells(filePath: string): Promise<void> {
try {
const replace = require('replace-in-file');
const regex = new RegExp(this.DatabricksCommandTagRegEx + '[\\r\\n]*' + this.CodeCellTag, 'g');
const options = {
files: filePath,
from: regex,
to: this.DatabricksCommandTagRegEx,
};

const results = await replace(options);
ThisExtension.log('Replacement results:', results[0].hasChanged);
}
catch (error) {
ThisExtension.log('Error occurred:', error);
}
}

static secondsToHms(seconds: number) {
var h = Math.floor(seconds / 3600);
var m = Math.floor(seconds % 3600 / 60);
Expand Down

0 comments on commit 04b84df

Please sign in to comment.