完全可行,速度很快,智能提示、代码格式化、查找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. priority_queue member function

    没有优先队列的dijkstra不算真的dijkstra 所以我又回来补常识了 <1>priority_queue::emplace <7>priority_queue::top ...

  2. 从入门到自闭之Python随机模块

    导入:import random 随机小数:random.random():大于0小于1之间的小数 指定数字之间的小数,不包含指定的最大值:random.uniform() 随机整数:random.r ...

  3. redis 学习(6)-- 集合类型

    redis 学习(6)-- 集合类型 set 结构 无序 无重复 集合间操作 set 集合内操作 命令 含义 sadd key memebr1 [member2...] 向集合中添加一个或多个成员 s ...

  4. MySQL性能优化(七):其它优化

    原文:MySQL性能优化(七):其它优化 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/v ...

  5. 第二篇 jQuery 选择器

    2-1,2  table隔行变色 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "h ...

  6. 第二章 单表查询 T-SQL语言基础(1)

    单表查询(1) 本章:逻辑查询处理,特定的SELECT查询生成正确的结果集而要经历的一系列逻辑阶段;单表查询的其他方面,包括:运算符,空值(NULL),字符的处理和临时数据,分级(ranking),C ...

  7. 自定义zabbix中的普通KEY及LLD KEY

    普通类型KEY 1.agent端: 编写自定义脚本,脚本需要有输出值返回给zabbix-server,并且给对应脚本赋予zabbix用户可执行权限 zabbix-agnet 且定义key名称和comm ...

  8. mysql 5.7.24 root密码重置

    sudo mysql -u root -p 初始root密码没有,直接按回车 show databases: use mysql; update user set authentication_str ...

  9. c++实现服务器和多个客户端的实时群聊通信

    我们通过TCP/IP来实现多人聊天室,如果租一个服务器我们就可以实现全网的多人聊天室(不懂tcp/ip的点进来https://www.cnblogs.com/yskn/p/9335608.html)! ...

  10. PAT Basic 1012 数字分类 (20 分)

    给定一系列正整数,请按要求对数字进行分类,并输出以下 5 个数字: A​1​​ = 能被 5 整除的数字中所有偶数的和: A​2​​ = 将被 5 除后余 1 的数字按给出顺序进行交错求和,即计算 n ...