Skip to content

Commit e553780

Browse files
author
彦熹
committed
PullRequest: 8 优化逻辑
1 parent 2853ab3 commit e553780

26 files changed

Lines changed: 219 additions & 86 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [0.3.1](https://code.alipay.com/cloud-ide/crew-dragon/compare/v0.3.0...v0.3.1) (2021-02-01)
2+
3+
4+
### Bug Fixes
5+
6+
* 修复 enum 定义错误 ([c15b756](https://code.alipay.com/cloud-ide/crew-dragon/commits/c15b756f036e14b4d6809f08bdea1d1cbf23e994))
7+
8+
9+
110
# [0.3.0](https://code.alipay.com/cloud-ide/crew-dragon/compare/v0.2.9...v0.3.0) (2021-02-01)
211

312

commitlint.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
extends: '@commitlint/config-conventional',
3+
rules: {
4+
'type-enum': [
5+
2,
6+
'always',
7+
[
8+
'build',
9+
'ci',
10+
'chore',
11+
'docs',
12+
'feat',
13+
'fix',
14+
'perf',
15+
'refactor',
16+
'revert',
17+
'style',
18+
'test',
19+
'release',
20+
],
21+
],
22+
},
23+
};

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "alex",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"workspaces": [
55
"packages/*"
66
],
@@ -41,11 +41,6 @@
4141
"prettier --parser=typescript --write"
4242
]
4343
},
44-
"commitlint": {
45-
"extends": [
46-
"@commitlint/config-conventional"
47-
]
48-
},
4944
"publishConfig": {
5045
"registry": "https://registry.npm.alibaba-inc.com"
5146
},
@@ -87,7 +82,7 @@
8782
{
8883
"publisher": "cloud-ide-ext",
8984
"name": "sarif-viewer",
90-
"version": "0.0.6"
85+
"version": "0.0.9"
9186
},
9287
{
9388
"publisher": "alex",
@@ -113,6 +108,11 @@
113108
"publisher": "alex",
114109
"name": "typescript-language-features-worker",
115110
"version": "1.0.0-beta.2"
111+
},
112+
{
113+
"publisher": "cloud-ide",
114+
"name": "vscode-lsif",
115+
"version": "0.1.2"
116116
}
117117
]
118118
}

packages/alex/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alipay/alex",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "@alipay/alex",
55
"main": "lib/index.js",
66
"typing": "types/index.d.ts",
@@ -64,11 +64,11 @@
6464
"@ali/ide-workspace": "1.33.0",
6565
"@ali/ide-workspace-edit": "1.33.0",
6666
"@ali/kaitian-textmate-languages": "^2.2.0",
67-
"@alipay/alex-cli": "0.3.0",
68-
"@alipay/alex-core": "0.3.0",
69-
"@alipay/alex-shared": "0.3.0",
70-
"@alipay/alex-code-service": "0.3.0",
71-
"@alipay/alex-i18n": "0.3.0"
67+
"@alipay/alex-cli": "0.3.1",
68+
"@alipay/alex-core": "0.3.1",
69+
"@alipay/alex-shared": "0.3.1",
70+
"@alipay/alex-code-service": "0.3.1",
71+
"@alipay/alex-i18n": "0.3.1"
7272
},
7373
"tnpm": {
7474
"mode": "yarn",

packages/alex/src/api/createApp.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
RuntimeConfig,
66
makeWorkspaceDir,
77
IAppOpts,
8-
STORAGE_NAME,
8+
STORAGE_DIR,
99
} from '@alipay/alex-core';
1010
import { SlotRenderer, SlotLocation, IAppRenderer, FILES_DEFAULTS } from '@ali/ide-core-browser';
1111
import { BoxPanel, SplitPanel } from '@ali/ide-core-browser/lib/components';
@@ -52,10 +52,10 @@ const getDefaultAppConfig = (): IAppOpts => ({
5252
defaultPanels: {
5353
bottom: '',
5454
},
55-
logDir: `${os.homedir()}/${STORAGE_NAME}/logs/`,
56-
preferenceDirName: STORAGE_NAME,
57-
storageDirName: STORAGE_NAME,
58-
extensionStorageDirName: STORAGE_NAME,
55+
logDir: `${os.homedir()}/${STORAGE_DIR}/logs/`,
56+
preferenceDirName: STORAGE_DIR,
57+
storageDirName: STORAGE_DIR,
58+
extensionStorageDirName: STORAGE_DIR,
5959
appName: 'ALEX',
6060
allowSetDocumentTitleFollowWorkspaceDir: false,
6161
});

packages/alex/src/integration/startup/index.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import { IAppInstance, AppRenderer } from '../..';
4-
import { GitFileSchemeModule } from '@alipay/alex-code-service';
3+
import { IAppInstance, AppRenderer, requireModule } from '../..';
4+
import { CodeServiceModule } from '@alipay/alex-code-service';
5+
import * as os from 'os';
6+
import * as path from 'path';
57
import * as Alex from '../..';
8+
import { isFilesystemReady, STORAGE_DIR } from '@alipay/alex-core';
69
import { StartupModule } from './startup.module';
710
import './languages';
811
import SarifViewer from '../../../extensions/cloud-ide-ext.sarif-viewer';
@@ -14,6 +17,15 @@ import typescript from '../../../extensions/alex.typescript-language-features-wo
1417

1518
(window as any).alex = Alex;
1619

20+
isFilesystemReady().then(async () => {
21+
console.log('filesystem ready');
22+
console.log(
23+
await requireModule('fs-extra').pathExists(
24+
path.join(os.homedir(), `${STORAGE_DIR}/settings.json`)
25+
)
26+
);
27+
});
28+
1729
const query = location.search
1830
.slice(1)
1931
.split('&')
@@ -31,7 +43,7 @@ ReactDOM.render(
3143
window.app = app;
3244
}}
3345
appConfig={{
34-
modules: [GitFileSchemeModule, StartupModule],
46+
modules: [CodeServiceModule, StartupModule],
3547
extensionMetadata: [css, html, json, markdown, typescript],
3648
workspaceDir: project,
3749
}}

packages/alex/src/integration/startup/startup.module.ts

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ExtensionServiceClientImpl, IExtensionNodeClientService } from '@alipay
1313
import { IExtensionMetadata } from '@alipay/alex-shared';
1414
import { IFileServiceClient } from '@ali/ide-file-service';
1515
import { KaitianExtFsProvider } from '@alipay/alex-core';
16+
import { CodeModelService } from '@alipay/alex-code-service';
1617

1718
import {
1819
StaticResourceContribution,
@@ -72,6 +73,12 @@ class ExtensionServiceClient extends ExtensionServiceClientImpl {
7273

7374
@Domain(CommandContribution)
7475
export class AlexAppContribution implements CommandContribution {
76+
@Autowired()
77+
codeModel: CodeModelService;
78+
79+
private ticket: number = 0;
80+
private tickets: number[] = [];
81+
7582
registerCommands(commands: CommandRegistry): void {
7683
// 保持和 api-server 一致
7784
commands.registerCommand(
@@ -91,11 +98,56 @@ export class AlexAppContribution implements CommandContribution {
9198
);
9299

93100
commands.registerCommand(
94-
{ id: 'alex.command.env.language' },
101+
{ id: 'alex.env.language' },
95102
{
96103
execute: () => getLanguageId(),
97104
}
98105
);
106+
107+
commands.registerCommand(
108+
{ id: 'alex.languages.setTextDocumentLanguage' },
109+
{
110+
execute: (uri: string, languageId: string) => {
111+
const modelService = (monaco as any).services.StaticServices.modelService.get();
112+
const modeService = (monaco as any).services.StaticServices.modeService.get();
113+
const model = modelService.getModel(uri);
114+
if (!model) {
115+
return Promise.reject(new Error('Invalid uri'));
116+
}
117+
const languageIdentifier = modeService.getLanguageIdentifier(languageId);
118+
if (!languageIdentifier || languageIdentifier.language !== languageId) {
119+
return Promise.reject(new Error(`Unknown language id: ${languageId}`));
120+
}
121+
modelService.setMode(model, modeService.create(languageId));
122+
return Promise.resolve(undefined);
123+
},
124+
}
125+
);
126+
127+
commands.registerCommand(
128+
{ id: 'alex.codeServiceProject' },
129+
{
130+
execute: () => {
131+
return {
132+
platform: this.codeModel.platform,
133+
project: this.codeModel.project,
134+
projectId: this.codeModel.projectId,
135+
commit: this.codeModel.commit,
136+
};
137+
},
138+
}
139+
);
140+
141+
commands.registerCommand(
142+
{ id: 'alex.subscribe' },
143+
{
144+
execute: () => {
145+
this.ticket++;
146+
this.tickets.push(this.ticket);
147+
return this.ticket;
148+
},
149+
}
150+
);
99151
}
100152
}
101153

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alipay/alex-cli",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "@alipay/alex-cli",
55
"main": "lib/commander.js",
66
"files": [
@@ -20,7 +20,7 @@
2020
"dependencies": {
2121
"@ali/ide-extension-installer": "^2.0.0",
2222
"@ali/ide-kaitian-extension": "1.33.0",
23-
"@alipay/alex-shared": "0.3.0",
23+
"@alipay/alex-shared": "0.3.1",
2424
"commander": "^6.2.0",
2525
"fs-extra": "^9.0.1",
2626
"lodash.pick": "^4.4.0",

packages/code-service/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alipay/alex-code-service",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "@alipay/alex-code-service",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
@@ -19,7 +19,7 @@
1919
"lockfile": "enable"
2020
},
2121
"dependencies": {
22-
"@alipay/alex-core": "0.3.0",
22+
"@alipay/alex-core": "0.3.1",
2323
"umi-request": "^1.3.5"
2424
}
2525
}

packages/code-service/src/code-service.contribution.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export class CodeContribution extends Disposable implements LaunchContribution {
5757

5858
const { codeFileSystem, idbFileSystem, overlayFileSystem } = await configureFileSystem(
5959
this.codeModel,
60-
this.codeAPI
60+
this.codeAPI,
61+
this.runtimeConfig.scenario
6162
);
6263
rootFS.mount(workspaceDir, overlayFileSystem);
6364
// 将只读文件系统挂载到 /code 上

0 commit comments

Comments
 (0)