## 1.116.0
This commit is contained in:
parent
baa3c222f3
commit
ab334f91dc
1
type-script-helper/.vscode/settings.json
vendored
1
type-script-helper/.vscode/settings.json
vendored
@ -21,6 +21,7 @@
|
|||||||
"files.watcherExclude": {
|
"files.watcherExclude": {
|
||||||
"**/node_modules": true
|
"**/node_modules": true
|
||||||
},
|
},
|
||||||
|
"explorer.sortOrder": "default",
|
||||||
"search.exclude": {
|
"search.exclude": {
|
||||||
"**/dist": true,
|
"**/dist": true,
|
||||||
"**/out": true
|
"**/out": true
|
||||||
|
31
type-script-helper/.vscode/tasks.json
vendored
31
type-script-helper/.vscode/tasks.json
vendored
@ -17,17 +17,31 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
"script": "vscode:publish",
|
"script": "vscode:package",
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"label": "npm: vscode:publish",
|
"label": "npm: vscode:package",
|
||||||
"detail": "node node_modules/@vscode/vsce/vsce package"
|
"detail": "node node_modules/@vscode/vsce/vsce package"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
"script": "webpack",
|
"script": "vscode:login",
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"label": "npm: webpack",
|
"label": "npm: vscode:login",
|
||||||
"detail": "webpack --config ./build/node-extension.webpack.config.js"
|
"detail": "node node_modules/@vscode/vsce/vsce login Infineon-Technologies-AG-Mesa-FI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "vscode:ls-publishers",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"label": "npm: vscode:ls-publishers",
|
||||||
|
"detail": "node node_modules/@vscode/vsce/vsce ls-publishers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "vscode:publish",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"label": "npm: vscode:publish",
|
||||||
|
"detail": "node node_modules/@vscode/vsce/vsce publish"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
@ -36,6 +50,13 @@
|
|||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"label": "npm: watch",
|
"label": "npm: watch",
|
||||||
"detail": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\""
|
"detail": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "webpack",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"label": "npm: webpack",
|
||||||
|
"detail": "webpack --config ./build/node-extension.webpack.config.js"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -211,3 +211,11 @@ None
|
|||||||
-----------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
- Infineon-Technologies-AG-Mesa-FI
|
- Infineon-Technologies-AG-Mesa-FI
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 1.116.0 1740441381597 = 638760381815970000 = 2025-0.Winter = Mon Feb 24 2025 16:56:21 GMT-0700 (Mountain Standard Time)
|
||||||
|
-----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Calculator
|
||||||
|
- Explorer Sort Order
|
||||||
|
34
type-script-helper/package-lock.json
generated
34
type-script-helper/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "type-script-helper",
|
"name": "infineon-technologies-ag-mesa-fi-cost-of-delay-helper",
|
||||||
"version": "1.110.0",
|
"version": "1.116.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "type-script-helper",
|
"name": "infineon-technologies-ag-mesa-fi-cost-of-delay-helper",
|
||||||
"version": "1.110.0",
|
"version": "1.116.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vscode/vsce": "^3.2.1",
|
"@vscode/vsce": "^3.2.1",
|
||||||
"polka": "^0.5.2"
|
"polka": "^0.5.2"
|
||||||
@ -21,6 +21,7 @@
|
|||||||
"@vscode/test-electron": "^2.4.0",
|
"@vscode/test-electron": "^2.4.0",
|
||||||
"@vscode/test-web": "*",
|
"@vscode/test-web": "*",
|
||||||
"concurrently": "^8.2.2",
|
"concurrently": "^8.2.2",
|
||||||
|
"editor-calc": "^2.1.0",
|
||||||
"eslint": "^8.25.0",
|
"eslint": "^8.25.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
@ -2768,6 +2769,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/decimal.js": {
|
||||||
|
"version": "10.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.5.0.tgz",
|
||||||
|
"integrity": "sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/deep-equal": {
|
"node_modules/deep-equal": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
|
||||||
@ -2867,6 +2875,17 @@
|
|||||||
"safe-buffer": "^5.0.1"
|
"safe-buffer": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/editor-calc": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/editor-calc/-/editor-calc-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-nOqwwanuiSAafEvAaPFm6xgB8fhRDvsWNRoEZTsCJPRQRQMOh2G792eE4XNPBwYTRWM6Odf42XhZpOlW6qcxrw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"decimal.js": "^10.4.2",
|
||||||
|
"parsimmon": "^1.18.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ee-first": {
|
"node_modules/ee-first": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||||
@ -6326,6 +6345,13 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/parsimmon": {
|
||||||
|
"version": "1.18.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz",
|
||||||
|
"integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/path-is-absolute": {
|
"node_modules/path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
@ -1,10 +1,42 @@
|
|||||||
{
|
{
|
||||||
"activationEvents": [],
|
"activationEvents": [
|
||||||
|
"onLanguage:csharp",
|
||||||
|
"onLanguage:markdown",
|
||||||
|
"onLanguage:javascript",
|
||||||
|
"onLanguage:json",
|
||||||
|
"onLanguage:typescript",
|
||||||
|
"onLanguage:yaml"
|
||||||
|
],
|
||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
],
|
],
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"commands": [
|
"commands": [
|
||||||
|
{
|
||||||
|
"category": "Calculate",
|
||||||
|
"command": "extension.calcAppendWithCursor",
|
||||||
|
"title": "Calculate and append in front of cursor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Calculate",
|
||||||
|
"command": "extension.calcAppend",
|
||||||
|
"title": "Calculate and append"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Calculate",
|
||||||
|
"command": "extension.calcReplaceWithCursor",
|
||||||
|
"title": "Calculate and replace in front of cursor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Explorer",
|
||||||
|
"command": "extension.rotateExplorerSortOrder",
|
||||||
|
"title": "Rotate Explorer Sort Order"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Calculate",
|
||||||
|
"command": "extension.calcReplace",
|
||||||
|
"title": "Calculate and replace"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"category": "Helper",
|
"category": "Helper",
|
||||||
"command": "copyHelper.copySyntaxInLight",
|
"command": "copyHelper.copySyntaxInLight",
|
||||||
@ -230,7 +262,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"title": "Type Script Helper Configuration",
|
"title": "Cost of Delay Helper Configuration",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -249,6 +281,7 @@
|
|||||||
"@vscode/test-electron": "^2.4.0",
|
"@vscode/test-electron": "^2.4.0",
|
||||||
"@vscode/test-web": "*",
|
"@vscode/test-web": "*",
|
||||||
"concurrently": "^8.2.2",
|
"concurrently": "^8.2.2",
|
||||||
|
"editor-calc": "^2.1.0",
|
||||||
"eslint": "^8.25.0",
|
"eslint": "^8.25.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
@ -290,5 +323,5 @@
|
|||||||
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"",
|
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"",
|
||||||
"webpack": "webpack --config ./build/node-extension.webpack.config.js"
|
"webpack": "webpack --config ./build/node-extension.webpack.config.js"
|
||||||
},
|
},
|
||||||
"version": "1.115.0"
|
"version": "1.116.0"
|
||||||
}
|
}
|
193
type-script-helper/src/calculator.ts
Normal file
193
type-script-helper/src/calculator.ts
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
import * as editorCalc from 'editor-calc';
|
||||||
|
|
||||||
|
export class CalcProvider implements vscode.CompletionItemProvider {
|
||||||
|
public enableActive: boolean;
|
||||||
|
|
||||||
|
private decorationType: vscode.TextEditorDecorationType;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public config: vscode.WorkspaceConfiguration,
|
||||||
|
private onError: (error: unknown) => any,
|
||||||
|
) {
|
||||||
|
this.enableActive = false;
|
||||||
|
this.decorationType = vscode.window.createTextEditorDecorationType({
|
||||||
|
dark: {
|
||||||
|
border: '1px dashed gray',
|
||||||
|
},
|
||||||
|
light: {
|
||||||
|
border: '1px dashed black',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async highlight(range: vscode.Range) {
|
||||||
|
const editor = vscode.window.activeTextEditor;
|
||||||
|
if (editor) {
|
||||||
|
editor.setDecorations(this.decorationType, [range]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async clearHighlight() {
|
||||||
|
const editor = vscode.window.activeTextEditor;
|
||||||
|
if (editor) {
|
||||||
|
editor.setDecorations(this.decorationType, []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public calculateLine(
|
||||||
|
position: vscode.Position,
|
||||||
|
exprLine: string,
|
||||||
|
): {
|
||||||
|
skip: number;
|
||||||
|
result: string;
|
||||||
|
insertText: string;
|
||||||
|
expressionRange: vscode.Range;
|
||||||
|
expressionWithEqualSignRange: vscode.Range;
|
||||||
|
expressionEndRange: vscode.Range;
|
||||||
|
} | null {
|
||||||
|
let skip, result;
|
||||||
|
try {
|
||||||
|
({ skip, result } = editorCalc.calculate(exprLine));
|
||||||
|
} catch (error) {
|
||||||
|
this.onError(error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const formulaRaw = exprLine.slice(skip);
|
||||||
|
const leftMatches = formulaRaw.match(/^\s+/);
|
||||||
|
const leftEmpty = leftMatches ? leftMatches[0].length : 0;
|
||||||
|
const rightMatches = formulaRaw.match(/[\s=]+$/);
|
||||||
|
const rightEmpty = rightMatches ? rightMatches[0].length : 0;
|
||||||
|
|
||||||
|
const insertText = exprLine.endsWith(' =') ? ` ${result}` : result;
|
||||||
|
|
||||||
|
return {
|
||||||
|
skip,
|
||||||
|
result,
|
||||||
|
insertText,
|
||||||
|
expressionRange: new vscode.Range(
|
||||||
|
position.line,
|
||||||
|
skip + leftEmpty,
|
||||||
|
position.line,
|
||||||
|
position.character - rightEmpty,
|
||||||
|
),
|
||||||
|
expressionWithEqualSignRange: new vscode.Range(
|
||||||
|
position.line,
|
||||||
|
skip + leftEmpty,
|
||||||
|
position.line,
|
||||||
|
position.character,
|
||||||
|
),
|
||||||
|
expressionEndRange: new vscode.Range(
|
||||||
|
position.line,
|
||||||
|
position.character,
|
||||||
|
position.line,
|
||||||
|
position.character,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private getCompletionResultsFromExtraCursors(document: vscode.TextDocument): {
|
||||||
|
additionalReplacements: vscode.Range[];
|
||||||
|
additionalTextInserts: string[];
|
||||||
|
additionalResults: string[];
|
||||||
|
} {
|
||||||
|
const additionalReplacements = [];
|
||||||
|
const additionalTextInserts = [];
|
||||||
|
const additionalResults = [];
|
||||||
|
|
||||||
|
const editor = vscode.window.activeTextEditor;
|
||||||
|
if (editor) {
|
||||||
|
for (const selection of editor.selections.slice(1)) {
|
||||||
|
const position = selection.active;
|
||||||
|
const exprLine = document.getText(
|
||||||
|
new vscode.Range(new vscode.Position(position.line, 0), position),
|
||||||
|
);
|
||||||
|
const lineCalcResult = this.calculateLine(position, exprLine);
|
||||||
|
if (lineCalcResult == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const { expressionWithEqualSignRange, insertText, result } =
|
||||||
|
lineCalcResult;
|
||||||
|
additionalReplacements.push(expressionWithEqualSignRange);
|
||||||
|
additionalTextInserts.push(insertText);
|
||||||
|
additionalResults.push(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { additionalReplacements, additionalTextInserts, additionalResults };
|
||||||
|
}
|
||||||
|
|
||||||
|
public async provideCompletionItems(
|
||||||
|
document: vscode.TextDocument,
|
||||||
|
position: vscode.Position,
|
||||||
|
_token: vscode.CancellationToken,
|
||||||
|
_context: vscode.CompletionContext,
|
||||||
|
): Promise<vscode.CompletionItem[]> {
|
||||||
|
const exprLine = document.getText(
|
||||||
|
new vscode.Range(new vscode.Position(position.line, 0), position),
|
||||||
|
);
|
||||||
|
if (!this.enableActive && !exprLine.trimRight().endsWith('=')) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const lineCalcResult = this.calculateLine(position, exprLine);
|
||||||
|
if (lineCalcResult == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
skip,
|
||||||
|
result,
|
||||||
|
expressionRange,
|
||||||
|
expressionWithEqualSignRange,
|
||||||
|
expressionEndRange,
|
||||||
|
insertText,
|
||||||
|
} = lineCalcResult;
|
||||||
|
|
||||||
|
this.clearHighlight().catch(this.onError);
|
||||||
|
|
||||||
|
this.highlight(expressionRange).catch(this.onError);
|
||||||
|
|
||||||
|
const { additionalReplacements, additionalTextInserts, additionalResults } =
|
||||||
|
this.getCompletionResultsFromExtraCursors(document);
|
||||||
|
const documentationPostfix =
|
||||||
|
additionalResults.length > 0 ? ' (multiple)' : '';
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: result,
|
||||||
|
kind: vscode.CompletionItemKind.Constant,
|
||||||
|
detail: `calc append${documentationPostfix}`,
|
||||||
|
documentation: `\`${exprLine
|
||||||
|
.slice(skip)
|
||||||
|
.trimStart()}${insertText}\`${documentationPostfix}`,
|
||||||
|
range: expressionEndRange,
|
||||||
|
additionalTextEdits: [
|
||||||
|
vscode.TextEdit.insert(expressionWithEqualSignRange.end, insertText),
|
||||||
|
...additionalReplacements.map((replacementRange, i) =>
|
||||||
|
vscode.TextEdit.insert(replacementRange.end, additionalTextInserts[i]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
insertText: '', // text specified here will be inserted on every line
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: result,
|
||||||
|
kind: vscode.CompletionItemKind.Constant,
|
||||||
|
detail: `calc replace${documentationPostfix}`,
|
||||||
|
documentation: `\`${result}\`${documentationPostfix}`,
|
||||||
|
additionalTextEdits: [
|
||||||
|
vscode.TextEdit.replace(expressionWithEqualSignRange, result),
|
||||||
|
...additionalReplacements.map((replacementRange, i) =>
|
||||||
|
vscode.TextEdit.replace(replacementRange, additionalResults[i]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
insertText: '',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
async resolveCompletionItem(
|
||||||
|
item: vscode.CompletionItem,
|
||||||
|
_token: vscode.CancellationToken,
|
||||||
|
): Promise<vscode.CompletionItem> {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,23 @@
|
|||||||
// The module 'vscode' contains the VS Code extensibility API
|
// The module 'vscode' contains the VS Code extensibility API
|
||||||
// Import the module and reference it with the alias vscode in your code below
|
// Import the module and reference it with the alias vscode in your code below
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
import * as Calculator from './calculator';
|
||||||
import * as copyHelper from './copyHelper';
|
import * as copyHelper from './copyHelper';
|
||||||
import * as kanbanHelper from './kanbanHelper';
|
import * as kanbanHelper from './kanbanHelper';
|
||||||
import * as markdownHelper from './markdownHelper';
|
import * as markdownHelper from './markdownHelper';
|
||||||
|
import * as settingsHelper from './settingsHelper';
|
||||||
import * as promiseLinesHelper from './promiseLinesHelper';
|
import * as promiseLinesHelper from './promiseLinesHelper';
|
||||||
import * as replaceLinesHelper from './replaceLinesHelper';
|
import * as replaceLinesHelper from './replaceLinesHelper';
|
||||||
import { WebviewPanelExample } from './WebviewPanelExample';
|
|
||||||
import * as readOnlyLinesHelper from './readOnlyLinesHelper';
|
import * as readOnlyLinesHelper from './readOnlyLinesHelper';
|
||||||
import { WebviewPanelCostOfDelay } from './WebviewPanelCostOfDelay';
|
import * as WebviewPanelExample from './WebviewPanelExample';
|
||||||
import { ColumnsToCardsWebviewViewProvider, refreshSidebar } from './ColumnsToCardsWebviewViewProvider';
|
import * as WebviewPanelCostOfDelay from './WebviewPanelCostOfDelay';
|
||||||
|
import * as ColumnsToCardsWebviewViewProvider from './ColumnsToCardsWebviewViewProvider';
|
||||||
|
|
||||||
// This method is called when your extension is activated
|
// This method is called when your extension is activated
|
||||||
// Your extension is activated the very first time the command is executed
|
// Your extension is activated the very first time the command is executed
|
||||||
export async function activate(extensionContext: vscode.ExtensionContext) {
|
export async function activate(extensionContext: vscode.ExtensionContext) {
|
||||||
|
|
||||||
const columnsToCardsWebviewViewProvider = new ColumnsToCardsWebviewViewProvider(extensionContext);
|
const columnsToCardsWebviewViewProvider = new ColumnsToCardsWebviewViewProvider.ColumnsToCardsWebviewViewProvider(extensionContext);
|
||||||
|
|
||||||
const item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
const item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
||||||
item.text = "$(beaker) Show Kanban";
|
item.text = "$(beaker) Show Kanban";
|
||||||
@ -23,25 +25,113 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
|
|||||||
item.show();
|
item.show();
|
||||||
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("columns-to-cards-webview-view-provider", columnsToCardsWebviewViewProvider));
|
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("columns-to-cards-webview-view-provider", columnsToCardsWebviewViewProvider));
|
||||||
|
|
||||||
// Use the console to output diagnostic information (console.log) and errors (console.error)
|
const config = vscode.workspace.getConfiguration('calc');
|
||||||
// This line of code will only be executed once when your extension is activated
|
const outputChannel = vscode.window.createOutputChannel('calc');
|
||||||
console.log('Congratulations, your extension "type-script-helper":1.6.2 is now active!');
|
|
||||||
|
|
||||||
// // The command has been defined in the package.json file
|
const onError = (error: unknown) => {
|
||||||
// // Now provide the implementation of the command with registerCommand
|
if (error instanceof Error) {
|
||||||
// // The commandId parameter must match the command field in package.json
|
outputChannel.appendLine(error.message);
|
||||||
// let disposable = vscode.commands.registerCommand('type-script-helper.helloWorld', () => {
|
if (error.stack) outputChannel.appendLine(error.stack);
|
||||||
// // The code you place here will be executed every time your command is executed
|
} else {
|
||||||
// // Display a message box to the user
|
outputChannel.appendLine((error as any).toString().message);
|
||||||
// vscode.window.showInformationMessage('Hello World from type-script-helper!');
|
}
|
||||||
// });
|
};
|
||||||
|
|
||||||
// context.subscriptions.push(disposable);
|
const calcProvider = new Calculator.CalcProvider(config, onError);
|
||||||
|
|
||||||
|
extensionContext.subscriptions.push(
|
||||||
|
vscode.languages.registerCompletionItemProvider('*', calcProvider, '=', ' '),
|
||||||
|
vscode.workspace.onDidOpenTextDocument(() => {
|
||||||
|
calcProvider.clearHighlight().catch(onError);
|
||||||
|
}),
|
||||||
|
vscode.window.onDidChangeTextEditorSelection(() => {
|
||||||
|
calcProvider.clearHighlight().catch(onError);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
async function replaceResultsWithPositions(
|
||||||
|
editor: vscode.TextEditor,
|
||||||
|
positionsAndExpressions: [vscode.Position, string][],
|
||||||
|
mode: 'append' | 'replace',
|
||||||
|
) {
|
||||||
|
await editor.edit((editBuilder) => {
|
||||||
|
for (const [position, expression] of positionsAndExpressions) {
|
||||||
|
const lineCalcResult = calcProvider.calculateLine(position, expression);
|
||||||
|
if (lineCalcResult == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const { insertText, expressionWithEqualSignRange, expressionEndRange } =
|
||||||
|
lineCalcResult;
|
||||||
|
|
||||||
|
if (mode === 'append') {
|
||||||
|
const endWithEqual = expression.trimEnd().endsWith('=');
|
||||||
|
editBuilder.replace(
|
||||||
|
expressionEndRange,
|
||||||
|
endWithEqual ? insertText : ` = ${insertText}`,
|
||||||
|
);
|
||||||
|
} else if (mode === 'replace') {
|
||||||
|
editBuilder.replace(expressionWithEqualSignRange, insertText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function replaceResult(
|
||||||
|
mode: 'append' | 'replace',
|
||||||
|
withCursor: boolean,
|
||||||
|
) {
|
||||||
|
const editor = vscode.window.activeTextEditor;
|
||||||
|
if (!editor || !editor.selection.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const doc = editor.document;
|
||||||
|
|
||||||
|
let positionsAndExpressions;
|
||||||
|
if (withCursor) {
|
||||||
|
positionsAndExpressions = editor.selections.map(
|
||||||
|
(selection) =>
|
||||||
|
<[vscode.Position, string]>[
|
||||||
|
selection.active,
|
||||||
|
doc
|
||||||
|
.lineAt(selection.active.line)
|
||||||
|
.text.slice(0, selection.active.character),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const uniqueLineNumbers = [
|
||||||
|
...new Set(editor.selections.map((selection) => selection.active.line)),
|
||||||
|
];
|
||||||
|
positionsAndExpressions = uniqueLineNumbers.map((number) => {
|
||||||
|
const line = doc.lineAt(number);
|
||||||
|
return <[vscode.Position, string]>[line.range.end, line.text];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await replaceResultsWithPositions(editor, positionsAndExpressions, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
extensionContext.subscriptions.push(
|
||||||
|
vscode.commands.registerTextEditorCommand('extension.calcAppendWithCursor', () => {
|
||||||
|
replaceResult('append', true).catch(onError);
|
||||||
|
}),
|
||||||
|
vscode.commands.registerTextEditorCommand('extension.calcAppend', () => {
|
||||||
|
replaceResult('append', false).catch(onError);
|
||||||
|
}),
|
||||||
|
vscode.commands.registerTextEditorCommand(
|
||||||
|
'extension.calcReplaceWithCursor',
|
||||||
|
() => {
|
||||||
|
replaceResult('replace', true).catch(onError);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
vscode.commands.registerTextEditorCommand('extension.calcReplace', () => {
|
||||||
|
replaceResult('replace', false).catch(onError);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
const commands = [
|
const commands = [
|
||||||
vscode.commands.registerCommand("copyHelper.copySyntaxInLight", copyHelper.copySyntaxInLight),
|
vscode.commands.registerCommand("copyHelper.copySyntaxInLight", copyHelper.copySyntaxInLight),
|
||||||
|
vscode.commands.registerCommand("extension.rotateExplorerSortOrder", settingsHelper.rotateExplorerSortOrder),
|
||||||
vscode.commands.registerCommand("kanban.refreshBoth", () => { kanbanHelper.refreshBoth(extensionContext); }),
|
vscode.commands.registerCommand("kanban.refreshBoth", () => { kanbanHelper.refreshBoth(extensionContext); }),
|
||||||
vscode.commands.registerCommand("kanban.refreshSidebar", refreshSidebar),
|
vscode.commands.registerCommand("kanban.refreshSidebar", ColumnsToCardsWebviewViewProvider.refreshSidebar),
|
||||||
vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor),
|
vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor),
|
||||||
vscode.commands.registerCommand("kanban.openInNewWindow", kanbanHelper.openInNewWindow),
|
vscode.commands.registerCommand("kanban.openInNewWindow", kanbanHelper.openInNewWindow),
|
||||||
vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile),
|
vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile),
|
||||||
@ -72,15 +162,15 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
|
|||||||
vscode.commands.registerCommand('replaceLinesHelper.unwrapSql', replaceLinesHelper.unwrapSql),
|
vscode.commands.registerCommand('replaceLinesHelper.unwrapSql', replaceLinesHelper.unwrapSql),
|
||||||
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlCSharp', replaceLinesHelper.wrapSqlCSharp),
|
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlCSharp', replaceLinesHelper.wrapSqlCSharp),
|
||||||
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlVB', replaceLinesHelper.wrapSqlVB),
|
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlVB', replaceLinesHelper.wrapSqlVB),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayMesa", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', ''); }),
|
vscode.commands.registerCommand("webview.costOfDelayMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', ''); }),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayEffortMesa", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'EFFORT'); }),
|
vscode.commands.registerCommand("webview.costOfDelayEffortMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'EFFORT'); }),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayLiveMesa", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'LIVE'); }),
|
vscode.commands.registerCommand("webview.costOfDelayLiveMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'LIVE'); }),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayWSJFMesa", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'WSJF'); }),
|
vscode.commands.registerCommand("webview.costOfDelayWSJFMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'WSJF'); }),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayLeominster", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', ''); }),
|
vscode.commands.registerCommand("webview.costOfDelayLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', ''); }),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayEffortLeominster", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'EFFORT'); }),
|
vscode.commands.registerCommand("webview.costOfDelayEffortLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'EFFORT'); }),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayLiveLeominster", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'LIVE'); }),
|
vscode.commands.registerCommand("webview.costOfDelayLiveLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'LIVE'); }),
|
||||||
vscode.commands.registerCommand("webview.costOfDelayWSJFLeominster", () => { WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'WSJF'); }),
|
vscode.commands.registerCommand("webview.costOfDelayWSJFLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'WSJF'); }),
|
||||||
vscode.commands.registerCommand("webview.example", () => { WebviewPanelExample.createOrShow(extensionContext); })
|
vscode.commands.registerCommand("webview.example", () => { WebviewPanelExample.WebviewPanelExample.createOrShow(extensionContext); })
|
||||||
];
|
];
|
||||||
|
|
||||||
commands.forEach(command => extensionContext.subscriptions.push(command));
|
commands.forEach(command => extensionContext.subscriptions.push(command));
|
||||||
|
29
type-script-helper/src/settingsHelper.ts
Normal file
29
type-script-helper/src/settingsHelper.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
async function rotateExplorerSortOrderLogic(): Promise<any> {
|
||||||
|
const config = vscode.workspace.getConfiguration("explorer");
|
||||||
|
const sortOrder = config.get("sortOrder");
|
||||||
|
let sortOrderOptions = [
|
||||||
|
"default",
|
||||||
|
"modified",
|
||||||
|
"type",
|
||||||
|
"mixed",
|
||||||
|
"filesFirst",
|
||||||
|
"foldersNestsFiles",
|
||||||
|
];
|
||||||
|
let index = sortOrderOptions.findIndex(l => l === sortOrder);
|
||||||
|
if (index !== -1)
|
||||||
|
index++;
|
||||||
|
else
|
||||||
|
index = 0;
|
||||||
|
if (index >= sortOrderOptions.length)
|
||||||
|
index = 0;
|
||||||
|
let value = sortOrderOptions[index];
|
||||||
|
await config.update("sortOrder", value);
|
||||||
|
index++;
|
||||||
|
if (index >= sortOrderOptions.length)
|
||||||
|
index = 0;
|
||||||
|
vscode.window.showInformationMessage(`Explorer Sort Order set to: ${value}; next will be: ${sortOrderOptions[index]};`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const rotateExplorerSortOrder = () => rotateExplorerSortOrderLogic();
|
Loading…
x
Reference in New Issue
Block a user