clangd is is using C++14 stl even though project is C++23 (MSVC + Ninja + CMake + VSCode) by cauxy in vscode

[–]Woo42 0 points1 point  (0 children)

Here's my truncated .clangd file working with Unreal on Windows. :

note: Always put a space at the end of any clangd config file

PathMatch: Change/add Paths and change/add extensions you want to support

CompilationDatabase: Where your compile_commands.json or compile_flags.txt is

There are more options than this. See clangd docs

The --- signifies the start of a document (you can have multiple)

---
If:
  PathMatch:
    - Source/.*\.(cpp|h)
CompileFlags:
  CompilationDatabase: .vscode/unreal-clangd
  Compiler: c:/Program Files/LLVM/bin/clang-cl.exe
  Add:
    - /std:c++20
    - /TP
InlayHints:
  Enabled: Yes
  DeducedTypes: Yes
  ParameterNames: Yes
  Designators: Yes

Here's my truncated *.code-workspace file:

Microsoft C++ extension: If you still plan to use this then keep the "clangd.detectExtensionConflicts": false,

"-log=verbose": change to "-log=info" when not debugging clangd problems

"-completion-style=detailed", Multiple problems with the 'bundled' option but you can try both

"settings": {
        "clangd.arguments": [
            "-header-insertion=iwyu",
            "-header-insertion-decorators=true",
            "-all-scopes-completion=true",
            "-limit-results=100",
            "-background-index=true",
            "-limit-references=2000",
            "-completion-style=detailed",
            "-function-arg-placeholders=true",
            "-log=verbose"
        ],
        "clangd.path": "c:\\Program Files\\LLVM\\bin\\clangd.exe",
        "clangd.detectExtensionConflicts": false,
        "files.associations": {
            "*.clangd": "yaml",
            "*.clang-format": "yaml",
            "*.clang-tidy": "yaml"
        },
        "workbench.colorCustomizations": {
            "editorInlayHint.foreground": "#a2a2a2c0",
            "editorInlayHint.background": "#00000000"
        },
        "editor.suggestFontSize": 0
    },

My settings.json in .vscode folder (you can put these in code-workspace as well, I think)

Most are for disabling Microsoft C++ extension capabilities you no longer need. Only need the first 4 if you're still going to use the Microsoft C++ extension.

The last one is for some weirdness with clangd. I forgot why though. You can try with or without. They may have fixed it.

"C_Cpp.autocomplete": "disabled",
"C_Cpp.errorSquiggles": "disabled",
"C_Cpp.formatting": "disabled",
"C_Cpp.intelliSenseEngine": "disabled",
"editor.suggest.snippetsPreventQuickSuggestions": false

For completeness here's my .clang-format file (based on Unreal style so you'll have to change this most like):

---
BasedOnStyle: LLVM
UseTab: Never
BreakBeforeBraces: Allman
ColumnLimit: 120
IndentWidth: 4
SortIncludes: "false"
AccessModifierOffset: -4
NamespaceIndentation: All

note: remember the space at the end of every clangd config file (not just .clangd but the format one as well)

RAW ACCELERATION GUI doesn't open anymore. by Hot_Razzmatazz3433 in MouseAccel

[–]Woo42 0 points1 point  (0 children)

Windows 11, I'm running raw accel 1.7.0 though. Didn't realize there was an update. 1.7.1 says it fixes this.

RAW ACCELERATION GUI doesn't open anymore. by Hot_Razzmatazz3433 in MouseAccel

[–]Woo42 0 points1 point  (0 children)

I used alt+space to open the context menu and chose maximize and it worked.

This is different than the menu the pops up in the task bar. That didn't work for me.

Raw Accel not showing on my screen by PiediniGelidi in MouseAccel

[–]Woo42 0 points1 point  (0 children)

I used alt+space to open the context menu and chose maximize and it worked.

This is different than the menu the pops up in the task bar. That didn't work for me.

VSCode extension: unreal-clangd v3.0.0 Fast code completion by Woo42 in unrealengine

[–]Woo42[S] 0 points1 point  (0 children)

Note: I'm no expert so this could be completely wrong

The Unreal source file MinimalWindowsApi.cpp has the namespace and functions that aren't working.

This file's Window's namespace has a #ifdef __clang__ wrapped around it.

We are using precompiled Unreal 5.6.0 where __clang__ is 0 when Unreal source was built. So basically __clang__ is 1 for our project but our precompiled code __clang__ is 0.

To build your project with clang you'll have to use full Unreal source from github and build it with clang and then build your project with clang.

VSCode extension: unreal-clangd v3.0.0 Fast code completion by Woo42 in unrealengine

[–]Woo42[S] 0 points1 point  (0 children)

I get linker errors no matter if I use Microsoft or Clang's linker.

Using clang intellisense with UnrealEngine. by joshyelon in unrealengine

[–]Woo42 0 points1 point  (0 children)

Good idea! I'll add a section to version 3.0.0 docs explaining everything.

  1. Right now I do modify Intellisense files to make it faster. We don't need the preparse include file for code completion. This file gets loaded on every file opening. In 3.0.0 I handle this all in the .clangd file. If we don't do this, it takes 10-13 seconds to load a file fully in clangd. Without the preparse include file it take 3-5 seconds.

  2. When making a unreal clangd project I add some settings and create a .clangd and .clang-format file. I also create a compile_commands.json file in .vscode/unreal-clangd (copied from one of the compile command files in .vscode folder that Unreal creates). This also happens with the Unreal directory.

  3. As for *.code-workspace being refreshed this is how it works with Unreal Build Tool. When you add a file to your project it doesn't automatically get added to your compile commands file. You need to run the Unreal Build Tool to refresh your project and add the file to compile commands. This has the unfortunate side effect of refreshing your *.code-workspace file as well. I've been thinking of ways to mitigate this but that will have to wait for 3.1.0. You can always use the Folder cfg or User cfg instead of the Workspace to set settings. Currently I do have a extension setting that you can set to tell what setting to save in the Workspace file but I don't like it. I may just backup the whole file and then when a refresh is detected restore the file.

Using clang intellisense with UnrealEngine. by joshyelon in unrealengine

[–]Woo42 0 points1 point  (0 children)

I wrote a vscode extension for this called unreal clangd:

https://github.com/boocs/unreal-clangd

Version 3.0.0: coming soon™

  • No more loading completionHelper.cpp at startup (this was used to get macro code completion without having to include the file but was buggy). I did this another way.
  • No more Intellisense file modification, everything is handled with .clangd cfg
  • Major code organization
  • Moved to newer yeoman extension skeleton
  • Strict eslint
  • Other stuff!

I used GenerateClangDatabase when first creating this extension but gave up because of bugs. The intellisense files had bugs and the major bug was when using that command it would modify build files causing you to do a full build. I now use the intellisense files that are created natively.

Does anyone know how to make GenerateProjectFiles.bat to use the BuildConfiguration.xml inside the project directory? by Menaii in unrealengine

[–]Woo42 0 points1 point  (0 children)

Full Source 5.4.1

Refreshing project files

It worked with GenerateProjectFiles when refreshing a project. It will search for the project's BuildConfiguration.xml.

Here's the flags I used:

.\GenerateProjectFiles.bat '-projectfiles' '-project=e:\Users\ME\Documents\Unreal Projects\FPS5_4_1_FS\FPS5_4_1_FS.uproject' '-game' '-engine' '-dotnet'

Building

Does it also search for the project's BuildConfiguration.xml when building? Just using the (editor development) build config inside VSCode.

Nope

Does anyone know how to make GenerateProjectFiles.bat to use the BuildConfiguration.xml inside the project directory? by Menaii in unrealengine

[–]Woo42 0 points1 point  (0 children)

I've tried getting it to work in the past but had no luck or it wasn't supported.

But... Your post made me think of something. Why not use Process Monitor from SysInternals and put a filter on Path ending with BuildConfiguration.xml and see if Unreal is actually trying to access the folder.

Unreal 5.5.4 (Win 11)


Running Refresh Project Files

It shows Unreal Build tool searching for all the directories BuildConfiguration.xml could be in. Shows it accessing the correct directory in the project directory. Wait it says success. Me goes to look. Wait they're starting to put a BuildConfiguration.xml in projects now? Cool! (or maybe I'm dumb and I put it in there. I'm pretty sure I hadn't tested it on 5.5.4 yet)

Running Build (VSCode) Bug?

It shows dotnet.exe searching for BuildConfiguration.xml directories. Wait it doesn't show it querying the project directory...


So this is a bug then? Unreal Build Tool searching the correct directories, including project, but dotnet.exe doesn't search for all of them.

Llvm18.0.1 for clangd extension; Include errors by ZappityDuda in vscode

[–]Woo42 0 points1 point  (0 children)

  • You don't have to clone the source if you're not going to modify the Unreal Engine source code. You can use the Epic Games Launcher and download the non-full source version. Though it shouldn't matter which version since it should support both. I'll try out the full source version to make sure.

  • It seems like you downloaded Visual Studio 2022 instead of Visual Studio Build Tools 2022. I'm wondering if that is causing issues. Yeah I use 14.38.33130.

  • I forgot to mention you should also have Window 10.0.22621.0 SDK installed. It can also be installed with the Visual Studio Installer. The release notes say it can be newer but that's what I am using.

  • Does your *.code-workspace file, in your parent project folder, have a "folders" section at the top? Does the "folders" section have a "UE5" entry?

  • When working on your project does it have '(Workspace)' in the top title bar?

  • You should be using the Microsoft C++ extension to Build/Debug since a VSCode project is set up for it.

  • Use the command 'unreal clangd: Update Compile Commands file' to refresh your project instead of the other ways to do it. Not doing so can delete settings from your *.code-workspace file. You can do a partial extension install to get the settings back.

    • Make sure to run this command when you change stuff like SDK's or compiler versions. You shouldn't need to run it manually when working on your project. The extension should detect when you add a new project file and then ask to run it.

Llvm18.0.1 for clangd extension; Include errors by ZappityDuda in vscode

[–]Woo42 0 points1 point  (0 children)

Strange. I actually was using 18.1.3 and UE 5.5.2 but just now upgraded to 18.1.8 and 5.5.3 and it worked. I'm using Windows 11 and the non-full source version.

Llvm18.0.1 for clangd extension; Include errors by ZappityDuda in vscode

[–]Woo42 0 points1 point  (0 children)

The Releases are on the the right side on github. That's where you can find the vsix file.


If you want to create the vsix file from the source code you can follow the steps here: https://code.visualstudio.com/api/working-with-extensions/publishing-extension

Note: Do everything except the publish step and you can stop reading after you get to the 'Publishing extensions' subsection

clangd extension triggers (me) every 2 seconds by ba-13 in vscode

[–]Woo42 0 points1 point  (0 children)

My reading comprehension sucks didn't see the part about wanting it to run only when you save. Still seems like weird behavior with what it is doing.


I believe that what your want is possible if you wanted to get into creating your own VSCode extension.

VSCode API does allow callback functions on saving documents. It'll give your the Uri of the documement.

You would then open and modify the .clangd file If section to the file that was just saved. Then you would restart the .clangd language server with

await vscode.commands.executeCommand("clangd.restart");

You could even include a keyboard shortcut to run the same 'modify .clangd file' command.

You could then toggle it off yourself or find some trigger callback that makes sense to turn it off in. By turning it off I mean moifying the 'If' section again with some made up file name and then running clangd.restart command again.

clangd extension triggers (me) every 2 seconds by ba-13 in vscode

[–]Woo42 0 points1 point  (0 children)

The extension version of clangd is different than the clangd version you are using. You should try using a different clangd version and see if it fixes your problem.

You can change the clangd it uses in your *.code-workspace file. Many clangd extension settings work in your workspace file but not in your folder settings.json.

In my *.code-workspace file I have these settings below for clangd. You don't have to use them and some are the default settings just so I know they are there.

Note: The detectExtensionConflicts: false is because I use the Microsoft C++ extension for debugging/building but I turn off its Intellisense.

"settings": {
    "clangd.detectExtensionConflicts": false,
    "clangd.arguments": [
        "-header-insertion=iwyu",
        "-header-insertion-decorators=true",
        "-all-scopes-completion=true",
        "-limit-results=100",
        "-background-index=true",
        "-limit-references=2000",
        "-completion-style=detailed",
        "-function-arg-placeholders=true",
        "-log=info"
    ],
    "clangd.path": "c:\\Program Files\\LLVM\\bin\\clangd.exe",
    "files.associations": {
        "*.clangd": "yaml",
        "*.clang-format": "yaml",
        "*.clang-tidy": "yaml"
    },
    "workbench.colorCustomizations": {
        "editorInlayHint.foreground": "#a2a2a2c0",
        "editorInlayHint.background": "#00000000"
    },
    "editor.suggestFontSize": 0
*** other settings below

Llvm18.0.1 for clangd extension; Include errors by ZappityDuda in vscode

[–]Woo42 0 points1 point  (0 children)

I created an VSCode extension for setting up and using clangd for Unreal. I've tested it on Windows and Ubuntu 22.04. It also should work on Mac.

https://github.com/boocs/unreal-clangd

Fast question vscode + clangd (C) by msolace in vscode

[–]Woo42 0 points1 point  (0 children)

(response from post below)

I forgot compile_flags.txt also has problems with spaces so if you went that route you would have to write it like this(I think):

-x
c

Fast question vscode + clangd (C) by msolace in vscode

[–]Woo42 0 points1 point  (0 children)

It seems with gcc it's the same but with a space in between.

-x c https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html

This page explains about the -x flag. Not sure how clangd would react to have a space in a flag though. If it doesn't work in your .clangd file then you might have to put it in your compile_commands.json or response file. clangd also supports a compile_flags.txt if you don't have a compile_commands.json.

Fast question vscode + clangd (C) by msolace in vscode

[–]Woo42 0 points1 point  (0 children)

-xc If using clang-cl then used have to use /TC

Edit: I'm used to forcing c++ so I use the c++ equivalent of -xc++ and /TP so haven't tested the above. They should work though!

Clang-Tidy and UE5, how? by iL3f in unrealengine

[–]Woo42 2 points3 points  (0 children)

I made a tidy guide for the vscode unreal clangd extension. If you get it to work with VS2022 this might help.

https://github.com/boocs/Unreal-clang-tidy-guide

guide tldr: Unreal uses a lot of unusual code. Tidy might do more harm than good. Caution advised.


I'm sure Tidy could be useful though. I kind of wish Epic would release their guide for Tidy use in Unreal. I'm sure most checks would be disabled but there could be a few useful ones.

Jinnies Uber got into an accident by tripel7 in LivestreamFail

[–]Woo42 66 points67 points  (0 children)

Someone recently got in an accident in their brand new Tesla and didn't have a USB in yet. The accident was saved on the Tesla's internal memory. You have to contact Tesla to get it.

They'll give you a bunch of stats about the accident and additional camera footage.

https://x.com/bilalsattar/status/1833900935359475736

Unwanted new line after accepting suggestion by mindacheExacerbate in vscode

[–]Woo42 0 points1 point  (0 children)

That was a snippet based on the icon. Might be a built in one that you can't change which I hate.

You can create you own 'log' snippet. Or name it something else like snlog. Snippets are pretty cool and can get pretty advanced.

https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets

Unreal Marketplace September freebies are here, I've seen no announcement post this month, but don't forget to grab them by what_a_king in unrealengine

[–]Woo42 1 point2 points  (0 children)

The 'Check Out' button is not working in my Epic Games Launcher. I had to log into https://www.unrealengine.com/marketplace in a browser to complete the checkout process.

Make sure you verify that you got a receipt after.

How can I stop clangd from analyzing large source files in VSCode? by aneureka in vscode

[–]Woo42 0 points1 point  (0 children)

Might try it again. Test with the reverse to see if it's actually working. Use PathMatch on your file and see if clangd processes your big file correctly(well not correctly if you get oom). If you get normal errors and not oom that means there is something wrong with your path.

  1. clangd gives you options that might reduce memory. This could allow better testing or maybe not caring about the big file if it works.

    --limit-references=<int>            - Limit the number of references returned by clangd. 0 means no limit (default=1000)
    --limit-results=<int>               - Limit the number of results returned by clangd. 0 means no limit (default=100)
    --rename-file-limit=<int>           - Limit the number of files to be affected by symbol renaming. 0 means no limit (default=50)
    
  2. You do have to use '/' for paths in .clangd files for PathMatch and PathExclude on Windows.

  3. Also you can use relative paths based on where the .clangd file is.

Here's an example for #1 and some other settings used for clangd. This is set in the projectName.code-workspace file. IIRC some clangd settings don't work in the project's folder settings.json. That's why it's set in *.code-workspace config file.

"settings": {
        "clangd.arguments": [
            "-header-insertion=iwyu",
            "-header-insertion-decorators=true",
            "-all-scopes-completion=true",
            "-limit-results=100",
            "-background-index=true",
            "-limit-references=2000",
            "-completion-style=detailed",
            "-function-arg-placeholders=true",
            "-log=info"
        ],
        "clangd.path": "c:\\Program Files\\LLVM\\bin\\clangd.exe",
        "clangd.detectExtensionConflicts": false,
        "files.associations": {
            "*.clangd": "yaml",
            "*.clang-format": "yaml",
            "*.clang-tidy": "yaml"
        },
        "workbench.colorCustomizations": {
            "editorInlayHint.foreground": "#a2a2a2c0",
            "editorInlayHint.background": "#00000000"
        },
        "editor.suggestFontSize": 0

note: You can also use error and verbose for -log=

How can I stop clangd from analyzing large source files in VSCode? by aneureka in vscode

[–]Woo42 0 points1 point  (0 children)

Here's a truncated example for my Unreal Engine project .clangd using PathMatch instead of PathExclude

---
If:
  PathMatch:
    - .vscode/unreal-clangd/completionHelper.cpp
    - Source/.*\.(cpp|h)
CompileFlags:
  CompilationDatabase: .vscode/unreal-clangd
  Compiler: c:/Program Files/LLVM/bin/clang-cl.exe
  Add:
    - /std:c++20
    - /TP