vscode开发环境配置

Visual Studio Code: https://code.visualstudio.com/

安装中文简体包

1.golang

golang下载:https://gomirrors.org/

git下载: https://git-scm.com/downloads

gcc(posix-seh)下载: https://sourceforge.net/projects/mingw-w64/files/

安装golang插件

按说明配置 go 1.13 及以上

1
2
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct

重启vscode

Ctrl+Shift+P输入Go:Install/Update Tools命令,选择要安装的工具

安装gopls(代码自动完成,跳转)

gopls配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"go.useLanguageServer": true,

"[go]": {
"editor.snippetSuggestions": "none",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},

"gopls": {
"completeUnimported": true,
"usePlaceholders": true,
"completionDocumentation": true,
"hoverKind": "SynopsisDocumentation" // No/Synopsis/Full, default Synopsis
},

"files.eol": "\n", // formatting only supports LF line endings

//此外还有一些ExperimentalFeatures:
"go.languageServerExperimentalFeatures": {
"format": true,
"autoComplete": true,
"rename": true,
"goToDefinition": true,
"hover": true,
"signatureHelp": true,
"goToTypeDefinition": true,
"goToImplementation": true,
"documentSymbols": true,
"workspaceSymbols": true,
"findReferences": true,
"diagnostics": false
},
"go.lintTool": "golangci-lint",

2.autojs

安装插件Auto.js-Pro-Ext(autojs pro 7),Auto.js-VSCodeExt(autojs 4.1)

autojs pro:Ctrl+Shift+P输入autojs pro选择命令

autojs:Ctrl+Shift+P输入autojs选择命令

3.TypeScript

1、首先在全局安装node.js

2、在全局安装TS

1
npm install -g typescript

3、在VSCODE编辑器中新建TS文件夹

  • 创建src根目录
  • 创建app.ts
  • 编写你的TS代码

(1)通过命令行运行TS文件

1
2
tsc ./src/app.ts --outFile ./dist/app.js
tsc ./src/* --outDir ./dist --watch

(2)可以通过tsconfig.json配置文件运行

  • tsc --init
  • 修改配置文件
1
2
"outDir": "./dist",
"rootDir": "./src"
  • 启动
1
tsc --watch