Skip to content

Commit

Permalink
chore(vscodePlugin):remove unnecessary files and format irregular code (
Browse files Browse the repository at this point in the history
#920)

* chore(vscodePlugin):remove unnecessary files and format irregular code

* fix: Type 'number' is not assignable to type 'Timeout'.

* chore: remove vscodePlugin yarn.lock
  • Loading branch information
RSS1102 authored Sep 24, 2024
1 parent 8ffe4c5 commit 4466bc1
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 4,844 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ pnpm-lock.yaml
/docs/.vitepress/cache/
/docs/.vitepress/dist/


#vscodePlugin
/vscodePlugin/yarn.lock

# config
examples/cherry-markdown-publish/src/common/config/*.yaml
File renamed without changes.
82 changes: 0 additions & 82 deletions vscodePlugin/src/CherryMarkdownEditorProvider.ts

This file was deleted.

67 changes: 0 additions & 67 deletions vscodePlugin/src/IndexPage.ts

This file was deleted.

14 changes: 6 additions & 8 deletions vscodePlugin/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function activate(context: vscode.ExtensionContext) {
}

// this method is called when your extension is deactivated
export function deactivate() {}
export function deactivate() { }

/**
* 获取当前文件的信息
Expand Down Expand Up @@ -108,7 +108,7 @@ const getMarkdownFileInfo = () => {
*/
const initCherryPanel = () => {
const { mdInfo, currentTitle } = getMarkdownFileInfo();
const workspaceFolder = vscode.workspace.workspaceFolders?.[0].uri.fsPath ?? '';
const workspaceFolder = vscode.workspace.workspaceFolders?.[0].uri.fsPath ?? '';
cherryPanel = vscode.window.createWebviewPanel(
'cherrymarkdown.preview',
currentTitle,
Expand All @@ -134,10 +134,8 @@ const initCherryPanel = () => {
initCherryPanelEvent();
};

// eslint-disable-next-line no-unused-vars, no-undef
let scrollTimeOut: NodeJS.Timeout;
// eslint-disable-next-line no-unused-vars, no-undef
let editTimeOut: NodeJS.Timeout;
let scrollTimeOut: ReturnType<typeof setTimeout> | undefined;
let editTimeOut: ReturnType<typeof setTimeout> | undefined;
const initCherryPanelEvent = () => {
cherryPanel?.webview?.onDidReceiveMessage(async (e) => {
const { type, data } = e;
Expand Down Expand Up @@ -215,8 +213,8 @@ const triggerEditorContentChange = (focus: boolean = false) => {
} else {
if (vscode.window.activeTextEditor?.document?.languageId === 'markdown') {
const cherryUsage: 'active' | 'only-manual' | undefined = vscode.workspace
.getConfiguration('cherryMarkdown')
.get('usage');
.getConfiguration('cherryMarkdown')
.get('usage');
if (cherryUsage === 'active' || focus) {
initCherryPanel();
}
Expand Down
24 changes: 1 addition & 23 deletions vscodePlugin/src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1 @@
import * as path from 'path';

import { runTests } from 'vscode-test';

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../');

// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index');

// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error('Failed to run tests');
process.exit(1);
}
}

main();
// TODO
15 changes: 0 additions & 15 deletions vscodePlugin/src/test/suite/extension.test.ts

This file was deleted.

38 changes: 0 additions & 38 deletions vscodePlugin/src/test/suite/index.ts

This file was deleted.

14 changes: 7 additions & 7 deletions vscodePlugin/src/types/upload.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// 上传方式
export type UploadType = 'None' | 'CustomUploader' | 'PicGoServer';

// 自定义请求
export interface CustomUploader {
enable: boolean;
url: string;
headers: HeadersInit;
}
// // 自定义请求
// export interface CustomUploader {
// enable: boolean;
// url: string;
// headers: HeadersInit;
// }

// 回填图片附加参数
export type BackfillImageProps = Array<'isBorder' | 'isShadow' | 'isRadius'>;

// 返回类型
// export type BackfillImage = Partial<Record<BackfillImageProps[number], boolean>>;
export type BackfillImage = {
[key in BackfillImageProps[number]]?: boolean;
[_key in BackfillImageProps[number]]?: boolean;
};
2 changes: 1 addition & 1 deletion vscodePlugin/src/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const getWebViewPath = (currentPanel: vscode.WebviewPanel) => {
const workspaceFolder = vscode.workspace.workspaceFolders![0].uri.fsPath ?? '';
const imgUri = vscode.Uri.file(workspaceFolder);
return currentPanel.webview.asWebviewUri(imgUri);
}
};

function writeGlobalVarsToFile(extensionPath: string, globalVars: { baseResourcePath: vscode.Uri }): string {
const globalVarsContent = `
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4466bc1

Please sign in to comment.