Skip to content

Commit 287db8b

Browse files
Add message about the library version in the header; release 0.2.4
1 parent a1b31d6 commit 287db8b

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

.vscodeignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ src/
99
tsconfig.json
1010
webpack.config.js
1111
yarn.lock
12-
library/test/
13-
library/test.exe
14-
library/test.d
12+
library/
13+
!library/mrpython
14+
!library/LICENSE
1515
.github/
1616
**/*.gch

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "mp-oi-library",
33
"displayName": "mp-oi-library",
44
"description": "Some algorithms and data structures template for competitive programming.",
5-
"version": "0.2.3",
5+
"version": "0.2.4",
66
"repository": "https://github.com/Mr-Python-in-China/mp-oi-library",
77
"license": "LGPL-3.0-only",
88
"author": {

src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ const extensionFileNoteRegex = /^\/\/ mp-oi-library extension note: file (.+)$/;
88
const extensionStartNoteStr =
99
'// mp-oi-library extension note: start. Do not modify this part.';
1010
const extensionEndNoteStr = '// mp-oi-library extension note: end';
11+
const extensionHeaderStr = '// mp-oi-library extension header: ';
1112

1213
interface HeaderItem extends vscode.QuickPickItem {
1314
data: { content: string; dependencies: string[] };
1415
}
1516

1617
export async function activate(context: vscode.ExtensionContext) {
18+
const packageJson = context.extension
19+
.packageJSON as typeof import('../package.json');
20+
const headMessage = `library version: @${packageJson.publisher}-${packageJson.version}`;
21+
1722
const headers = await getProcessedFileContent(context.extensionPath);
1823

1924
const items: HeaderItem[] = Array.from(headers.entries(), ([name, dat]) => ({
@@ -65,6 +70,7 @@ export async function activate(context: vscode.ExtensionContext) {
6570
.edit(editBulder => {
6671
const v = writeIncludeToFile(
6772
fileContent,
73+
headMessage,
6874
pick.selectedItems.map(x => ({
6975
file: x.label,
7076
content: x.data.content
@@ -155,6 +161,7 @@ function getIncludeFromFile(content: string) {
155161

156162
function writeIncludeToFile(
157163
content: string,
164+
headMessage: string,
158165
includes: { file: string; content: string }[]
159166
) {
160167
const lines = content.split('\n');
@@ -167,6 +174,7 @@ function writeIncludeToFile(
167174
end,
168175
content: [
169176
extensionStartNoteStr,
177+
extensionHeaderStr + headMessage,
170178
...includes.map(
171179
x => `// mp-oi-library extension note: file ${x.file}\n${x.content}`
172180
),

tsconfig.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
22
"compilerOptions": {
3-
"module": "ESNext",
3+
"module": "NodeNext",
4+
"moduleResolution": "NodeNext",
45
"target": "ES2022",
5-
"lib": ["ES2022"],
6+
"lib": [
7+
"ES2022"
8+
],
69
"sourceMap": true,
710
"rootDir": "src",
811
"strict": true,
9-
"allowSyntheticDefaultImports":true,
12+
"allowSyntheticDefaultImports": true,
1013
"esModuleInterop": true,
11-
"noImplicitAny": true
14+
"noImplicitAny": true,
15+
"resolveJsonModule": true
1216
}
13-
}
17+
}

0 commit comments

Comments
 (0)