完全可行,速度很快,智能提示、代码格式化、查找Symbol等等都不比VS+Visual AssistX 差。

准备

  1. 打开编辑器的Editor Preferences>Source Code,选择VSCode
  2. 在工程的uproject文件上右键>Generate Visual Studio Project,就会生成一个workspace文件,双击即可打开visual studio code. 同时生成的还有一个.vscode文件夹。

配置VSCode

  1. VSCode需要的插件网上众说纷纭,实际证明,只需要这三个就够了:

什么clang-format之类的完全不需要,因为c/c++里面自带了clang-format.

打开设置(Ctrl+,或者File>Preferences>Settings)

选择Extensions>C/C++

C_Cpp:Autocomplete    Default
C_Cpp:Clang_format_fallback Style Visual Studio(这里是防止Clang_format_style填写的是file,而系统找不到.clang-format文件时候的情况)
C_Cpp:Clang_format_path 不需要填写(默认配置好了)
C_Cpp:Clang_format_style Visual Studio(或者LLVM)
C_Cpp>Default: Cpp Standard c++11
C_Cpp:Workspace Symbols All

最后这条最重要,否则查找Symbol时候就无法识别到UE源码中的代码了。

注意上面的两个format 可以取值Visual Studio, LLVM, Google, WebKit等。推荐使用WebKit

如果追求完美,可以这样设置

官方C/C++插件自带的clang-format版本是6.0,所以设置相关选项时要注意参考的文档版本。

可以自行下载最新的clang-format文件,目前最新版本是7.0。

下载位置:下载

选择编译好的win64版本。

安装好以后只需要找到里面的clang-format.exe 拷贝到别处(例如C:/),其余部分就可以卸载了。

然后将C_Cpp:Clang_format_path设置为刚下载的clang-format.exe路径:

"C_Cpp.clang_format_path": "C:\\clang-format.exe",

C_Cpp:Clang_format_style设置为file,表示从工作目录或上级文件夹中寻找.clang-format配置文件。

在工作目录中创建一个名称为.clang-format的文件

windows系统中无法创建名字以.开头的文件,可以这样创建:打开cmd,输入echo >.clang-format ,回车即可创建。

内容用下方内容粘贴

这里有一个专门为UE4配置好的.clang-format文件内容:

---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 0
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
FixNamespaceComments: true
ForEachMacros:
- for
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '.*\.generated\.h'
Priority: 100
- Regex: '.*(PCH).*'
Priority: -1
- Regex: '".*"'
Priority: 1
- Regex: '^<.*\.(h)>'
Priority: 3
- Regex: '^<.*>'
Priority: 4
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 4
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Always
...

自动格式化

Text Editor> Formatting

Format On Save和Format On Type都打勾。

常用快捷操作

打开Symbol: 按Ctrl键并鼠标左键点击Symbol

查找Symbol: 选择Symbol并Ctrl+T (VAssist中的Alt+Shift+S)

转到定义: F12

转到声明: Ctrl+F12

重命名: Ctrl+F2

切换头/源文件: Alt+O (VAssist快捷键一样)

快速打开文件: Ctrl+P (VAssist中的Alt+Shift+O)

使用VSCODE开发UE4的更多相关文章

  1. .Net Core Linux centos7行—vscode开发,linux部署运行

    前面搭建好啦linux运行环境,下面搭建windows下的开发环境.并完成调试 参考地址:https://www.microsoft.com/net/core#windows. 按照步骤来就好.安装. ...

  2. vscode 开发.net core 从安装到部署 教程详解

    一:环境准备: windows系统需要 win7 sp1 / windows 8  / windows 2008 r2 sp1 / windows10: 其他版本的windows系统在安装.NET C ...

  3. 用VSCode开发一个基于asp.net core 2.0/sql server linux(docker)/ng5/bs4的项目(1)

    最近使用vscode比较多. 学习了一下如何在mac上使用vscode开发asp.netcore项目. 这里是我写的关于vscode的一篇文章: https://www.cnblogs.com/cgz ...

  4. 用VSCode开发一个基于asp.net core 2.0/sql server linux(docker)/ng5/bs4的项目(3)

    第一部分: http://www.cnblogs.com/cgzl/p/8478993.html 第二部分: http://www.cnblogs.com/cgzl/p/8481825.html 由于 ...

  5. 使用vscode开发调试.net core应用程序并部署到Linux跨平台

    使用VS Code开发 调试.NET Core RC2应用程序,由于.NET Core 目前还处于预览版. 本文使用微软提供的示例进行开发及调试. https://github.com/aspnet/ ...

  6. vsCode 开发微信小程序插件

    用 vsCode 开发微信小程序可以配置以下插件,让开发更美好: 1. vscode weapp api 2. vscode wxml 3. vscode-wechat 4. Easy WXLESS ...

  7. 用vscode开发vue应用[转]

    https://segmentfault.com/a/1190000019055976 现在用VSCode开发Vue.js应用几乎已经是前端的标配了,但很多时候我们看到的代码混乱不堪,作为一个前端工程 ...

  8. 【.NET Core项目实战-统一认证平台】基于jackcao博客使用VSCode开发及感悟One搭建开发环境

    原博客系列文章链接:https://www.cnblogs.com/jackcao/ 金焰的世界 感谢博主无私的奉献,感谢博主幼儿班的教学 基于jackcao博客使用VsCode开发及感悟One搭建开 ...

  9. 用vscode开发vue应用

    阅读 3237 收藏 205 2019-05-02 原文链接:segmentfault.com 云服务器 1 核 2G , 9元/月 ,买十送二,99/年!!!快来上车!developer.huawe ...

随机推荐

  1. go语言坑之并发访问map

    fatal error: concurrent map read and map write 并发访问map是不安全的,会出现未定义行为,导致程序退出.所以如果希望在多协程中并发访问map,必须提供某 ...

  2. Codeforces 1203F2. Complete the Projects (hard version)

    传送门 首先对于 $b>0$ 的工作显然有个贪心,把 $b>0$ 的按 $a$ 从小到大排序 把能做的都做了,然后得到一个最大等级 剩下就是考虑 $b<0$ 的工作了,看到数据显然可 ...

  3. 剑指offer-构建乘积数组-数组-python

    题目描述 给定一个数组A[0,1,...,n-1],请构建一个数组B[0,1,...,n-1],其中B中的元素B[i]=A[0]*A[1]*...*A[i-1]*A[i+1]*...*A[n-1].不 ...

  4. 关于Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: 11043的解决办

    Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: /tmp/hsperfdat ...

  5. python中同步、多线程、异步IO、多线程对IO密集型的影响

    目录 1.常见并发类型 2.同步版本 3.多线程 4.异步IO 5.多进程 6.总结 1.常见并发类型 I/ O密集型: 蓝色框表示程序执行工作的时间,红色框表示等待I/O操作完成的时间.此图没有按比 ...

  6. Delphi ListBox组件

  7. PAT Basic 1019 数字黑洞 (20 分)

    给定任一个各位数字不完全相同的 4 位正整数,如果我们先把 4 个数字按非递增排序,再按非递减排序,然后用第 1 个数字减第 2 个数字,将得到一个新的数字.一直重复这样做,我们很快会停在有“数字黑洞 ...

  8. hive不分区增量更新

    insert overwrite table ods.zeg_so select *,case when zsm.id is not null then cast(current_timestamp ...

  9. shoeBox超实用的雪碧图(Sprite)图制作工具-使用

    从前端优化说起 浏览器载入单张图片的速度基本取决于图片的大小,但是载入多张图片的速度却和另一个要素息息相关-网络请求数,在图片大小和一致的情况下,图片张数越少其请求数越少其载入速度也就越快.所以在使用 ...

  10. nmap脚本(nse)使用总结

    nmap脚本主要分为以下几类,在扫描时可根据需要设置--script=类别这种方式进行比较笼统的扫描: auth: 负责处理鉴权证书(绕开鉴权)的脚本   broadcast: 在局域网内探查更多服务 ...