Skip to content

Commit 892c6a3

Browse files
committed
programmatic features
add reference provider and code formator fix outline view mistake `asseme cs:code` for label fix diagnose can't display fatal message: view fatal as error Merge branch 'next' into master
2 parents 5bfc5a1 + 592ed11 commit 892c6a3

File tree

17 files changed

+1074
-882
lines changed

17 files changed

+1074
-882
lines changed

.vscode/launch.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@
1818
],
1919
"preLaunchTask": "${defaultBuildTask}"
2020
},
21+
{
22+
"name": "Run Extension(no i18n)",
23+
"type": "extensionHost",
24+
"request": "launch",
25+
"runtimeExecutable": "${execPath}",
26+
"args": [
27+
"--extensionDevelopmentPath=${workspaceFolder}"
28+
],
29+
"outFiles": [
30+
"${workspaceFolder}/out/**/*.js"
31+
],
32+
"preLaunchTask": "${defaultBuildTask}"
33+
},
2134
{
2235
"name": "Extension Tests",
2336
"type": "extensionHost",

CHANGELOG.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
# Change Log
22

3-
All notable changes to the "masm-tasm" extension will be documented in this file.Welcome [issue](https://github.com/xsro/masm-tasm/issues) and PR
3+
## welcome any feedback [issue](https://github.com/xsro/masm-tasm/issues)
44

5-
## 目标
5+
## 0.2.1
66

7-
- [ ] 搞一个好看的logo和名字
8-
- [ ] 问题匹配功能完善
9-
- [ ] hover的简单实现:如中断的简单信息
10-
- [ ] LSP和DAP支持(目前对我来说太难了
11-
- [ ] 根据具体的AH值显示跳转到不同的信息
7+
- [x] `dosbox here`增加了一个命令以在当前文件所在目录下打开dosbox,来提供更加自由的操作,见demo
8+
- [x] 优化diagnose对fatal类错误的匹配,优化大纲视图
9+
- [x] 提供代码格式化功能(需要完善并且现在的效果并不是很好)
10+
- [x] 提供查找引用功能(目前也并不完美
11+
- [ ] webpack打包(nls部分总是失败)
1212

13-
### 0.2.0
13+
鉴于这些功能目前可能不完善,你可以在设置中关闭他们(关闭后需要手动重启)
14+
15+
DEMO `dosbox here`示例: 代码来自[dpisdaniel/assembly-pacman](https://github.com/dpisdaniel/assembly-pacman)
16+
17+
![demo pacman](https://github.com/xsro/masm-tasm/raw/next/pics/demo_pacman.gif)
18+
19+
## 0.2.0
1420

1521
- [x] DOS 汇编基本的语法支持
1622
- [x] vscode 界面的大纲视图的简单实现
1723

1824
汇编语言支持的symbol大概有以下几种,但是vscode的[SymbolKind](https://code.visualstudio.com/api/references/vscode-api#SymbolKind)却与它们不对应,我决定做以下对应
1925

20-
|assembly symbol|vscode symbol|
21-
|---|---|
22-
|macro|Module|
23-
|segment|Class|
24-
|procedure|Function|
25-
|struct|Struct|
26-
|label|Key|
27-
|variable|Variable|
26+
|assembly symbol|vscode symbol|汇编关键字|vscode关键字|
27+
|---|---|---|----|
28+
|macro|Module||模块|
29+
|segment|Class|||
30+
|procedure|Function|子程序|函数|
31+
|struct|Struct|结构体|结构体|
32+
|label|Key|标号||
33+
|variable|Variable|变量|变量|
2834

2935
### 0.1.4
3036

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文](https://github.com/xsro/masm-tasm/blob/master/doc/README_zh.md)|[English](https://github.com/xsro/masm-tasm/blob/master/README.md)
44

5-
Language support for DOS assembly,suitable for studying MASM/TASM and the course <*principles& peripheral technology of microprocessor*>.
5+
Language support for DOS assembly,may be suitable for studying MASM/TASM and the course <*principles& peripheral technology of microprocessor*>.
66

77
- Offer *grammar*,basic *outline* view and *hover* support for DOS assembly language
88
- Support both **TASM and MASM** assembler tools: choose MASM or TASM in the preference
@@ -21,13 +21,13 @@ when you are editing `assembly` files ,you can right click at the editor panel,t
2121
2. "Run ASM code": Compile and Run the program
2222
3. "Debug ASM code": Compile and Debug the program
2323

24-
### Demo 1: using MASM(via msdos-player)
24+
### Demo 1: using TASM(via dosbox, default mode)
2525

26-
![demo msdos-player masm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_msdos_masm.gif)
26+
![demo dosbox tasm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_dosbox_tasm.gif)
2727

28-
### Demo 2: using TASM(via dosbox)
28+
### Demo 2: using MASM(via msdos-player)
2929

30-
![demo dosbox tasm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_dosbox_tasm.gif)
30+
![demo msdos-player masm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_msdos_masm.gif)
3131

3232
### Demo 3: Open dosbox and type the command you need
3333

@@ -67,7 +67,12 @@ the extension has built in tools for windows. But if you need to use assembler o
6767
3. `dosbox`: dosbox.exe and related files
6868
4. `player`: msdos.exe
6969

70-
Linux and other OS user do not need folder dosbox and player. Instead, we should make sure DOSBox can be opened by shell command `dosbox` (node: child_process.exec("dosbox"))
70+
Linux and other OS user do not need folder dosbox and player. Instead, we should make sure DOSBox can be opened by shell command `dosbox` (node: child_process.exec("dosbox")). Use command like
71+
72+
```sh
73+
sudo apt install dosbox #install dosbox
74+
dosbox #if successfully opened the dosbox, it is largely possible for the extension to use dosbox
75+
```
7176

7277
### About use of DOSBox
7378

i18n/chs/package.i18n.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
"dosasm.config.boxrun.enum1":"运行之后在dosbox窗口停留,可以输入exit,点击x,或者Ctrl+F9关闭程序",
1818
"dosasm.config.boxrun.enum2":"运行程序之后自动关闭",
1919
"dosasm.config.boxrun.enum3":"运行程序之后先停顿一下 输入任意字符后关闭窗口",
20-
"dosasm.config.dosbox.resolution":"自定义dosbox窗口大小,格式如1024x640,不设置则为DOSBox默认大小"
20+
"dosasm.config.dosbox.resolution":"自定义dosbox窗口大小,格式如1024x640,不设置则为DOSBox默认大小",
21+
"dosasm.command.dosboxhere":"打开DOSBox将当前文件所在目录挂载到E盘,并配置相关环境"
2122
}

language-configuration.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"surroundingPairs": [
1818
["[", "]"],
1919
["\"", "\""],
20-
["'", "'"]
20+
["'", "'"],
2121
],
2222
"wordPattern": "('(.*?)')|(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\:\\;\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)|(\\;.+$)",
2323
"folding": {
2424
"markers": {
25-
"start": "proc|struct",
26-
"end": "endp|ends"
25+
"start": "^\\s*\\w+\\s+proc|struct|PROC|STRUCT|SEGMENT|MACRO|macro",
26+
"end": "^\\s*\\w*\\s*endp|ends|ENDP|ENDS|ENDM|endm"
2727
}
2828
},
2929
"indentationRules": {

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "masm-tasm",
33
"displayName": "MASM/TASM",
44
"publisher": "xsro",
5-
"description": "DOS汇编语言开发环境和语法支持,安装即用,自带DOSBox.exe和TASM/MASM工具",
6-
"version": "0.2.0",
7-
"keywords":["dosbox","16位","汇编","微机原理","tasm","masm"],
5+
"description": "DOS汇编语言开发环境和语法支持,win下安装即用,自带DOSBox.exe和TASM/MASM工具",
6+
"version": "0.2.1",
7+
"keywords":["dosbox","16位","汇编","微机原理","tasm","masm","8086"],
88
"icon":"dosboxasm.png",
99
"engines": {
1010
"vscode": "^1.47.0"
@@ -24,7 +24,8 @@
2424
"onLanguage:asm",
2525
"onLanguage:masm",
2626
"onLanguage:tasm",
27-
"onLanguage:assembly"
27+
"onLanguage:assembly",
28+
"onCommand:dosboxhere"
2829
],
2930
"main": "./out/extension.js",
3031
"contributes": {
@@ -88,6 +89,10 @@
8889
{
8990
"command":"masm-tasm.cleanalldiagnose",
9091
"title":"%dosasm.command.cleanalldianose%"
92+
},
93+
{
94+
"command":"masm-tasm.dosboxhere",
95+
"title":"%dosasm.command.dosboxhere%"
9196
}
9297
],
9398
"configuration" :{
@@ -127,7 +132,7 @@
127132
"masmtasm.language.programmaticFeatures":{
128133
"type":"boolean",
129134
"default":true,
130-
"description": "experimental programmatic features like hover,outline,jump to definition. You can close them by choosing false"
135+
"description": "Experimental programmatic features like hover,outline,jump to definition/reference. Restart needed"
131136
},
132137
"masmtasm.dosbox.run": {
133138
"type": "string",

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
"dosasm.config.boxrun.enum1":"do nothing, manually input exit or click 'x' or press 'Ctrl+F9' to exit",
1818
"dosasm.config.boxrun.enum2":"exit DOSBox automatically",
1919
"dosasm.config.boxrun.enum3":"pause and then exit",
20-
"dosasm.config.dosbox.resolution":"Set dosbox resolution like '1024x640'.If left empty, it means use the default resolution of DOSBox"
20+
"dosasm.config.dosbox.resolution":"Set dosbox resolution like '1024x640'.If left empty, it means use the default resolution of DOSBox",
21+
"dosasm.command.dosboxhere":"Dosbox here: Open DosBox, Mount the path of the editor files's folder as E:\\ and set the needed environment"
2122
}

pics/demo_pacman.gif

1.21 MB
Loading

src/DOSBox.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ export class DOSBox{
3131
}
3232
if(diag && doc) this.BOXdiag(conf,diag,doc)
3333
}
34+
public BoxOpenCurrentFolder(conf:Config,doc:TextDocument){
35+
let folderpath:string=Uri.joinPath(doc.uri,'../').fsPath
36+
let Ecmd:string='-noautoexec -c "mount e \\\"'+folderpath+'\\\"" -c "mount c \\\"'+conf.path+'\\\"" -c "set PATH=%%PATH%%;c:\masm;c:\\tasm"-c "e:"'
37+
if(process.platform=='win32'){
38+
let wincommand='start/min/wait "" "'+conf.path+'/dosbox/dosbox.exe" -conf "'+conf.dosboxconfuri.fsPath+'" '
39+
execSync(wincommand+Ecmd,{cwd:conf.workpath,shell:'cmd.exe'})
40+
}
41+
else{
42+
let linuxcommand='dosbox -conf "'+conf.dosboxconfuri.fsPath+'" '
43+
execSync(linuxcommand+Ecmd,{cwd:conf.workpath})
44+
}
45+
46+
}
3447
private BOXdiag(conf:Config,diag:landiagnose,doc:TextDocument):string{
3548
let info:string=' ',content:string
3649
let document=doc

src/configration.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export class Config {
9595
{
9696
let configUri=conf.dosboxconfuri
9797
let Pathadd=' '
98-
Pathadd='set PATH=c:\\tasm;c:\\masm'
9998
let configContent = `[sdl]
10099
windowresolution=${conf.resolution}
101100
output=opengl
@@ -104,7 +103,7 @@ mount c "${conf.path}"
104103
mount d "${conf.workpath}"
105104
mount x "${conf.batchpath}"
106105
d:
107-
${Pathadd}`;
106+
set PATH=%PATH%;c:\\tasm;c:\\masm`;
108107
if (autoExec) configContent=configContent+'\n'+autoExec
109108
this.writefile(configUri,configContent)
110109
}

0 commit comments

Comments
 (0)