Skip to content

Commit

Permalink
🐞 fix: 解决插件启动时自动执行的方法中获取不到 extensionContext
Browse files Browse the repository at this point in the history
  • Loading branch information
wjkang committed Dec 23, 2024
1 parent d2abc1b commit 82aa3b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "lowcode",
"description": "lowcode tool, support ChatGPT and other LLM",
"author": "wjkang <ruoxieme@gmail.com>",
"version": "1.8.8",
"version": "1.8.9",
"icon": "asset/icon.png",
"publisher": "wjkang",
"repository": "https://github.com/lowcoding/lowcode-vscode",
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions,
);

runActivate();
runActivate(context);

init({ extensionContext: context, extensionPath: context.extensionPath });

Expand Down
6 changes: 3 additions & 3 deletions src/lifecycle.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as path from 'path';
import * as fs from 'fs-extra';
import { window } from 'vscode';
import { window, ExtensionContext } from 'vscode';
import { getSnippets } from './utils/materials';
import { getEnv, rootPath } from './utils/vscodeEnv';

export const runActivate = () => {
export const runActivate = (extensionContext: ExtensionContext) => {
const templateList = getSnippets().filter((s) => s.preview.runActivate);
templateList.forEach((template) => {
const scriptFile = path.join(template!.path, 'script/index.js');
Expand All @@ -14,7 +14,7 @@ export const runActivate = () => {
if (script.onActivate) {
const context = {
workspaceRootPath: rootPath,
env: getEnv(),
env: { ...getEnv(), extensionContext },
materialPath: template!.path,
code: '',
};
Expand Down

0 comments on commit 82aa3b1

Please sign in to comment.