Configure VSCode to analyze correctly test module

Hi here,

I'm not sure if it's the right place, but I didn't find a VSCode+Rust place to open a discussion ...

When I write test module in VSCode, It seems not analyzed with test enabled :

My VSCode extensions are :

code --list-extensions                                           
a5huynh.vscode-ron
alefragnani.bookmarks
alefragnani.project-manager
alexkrechik.cucumberautocomplete
bungcip.better-toml
coenraads.bracket-pair-colorizer-2
coolbear.systemd-unit-file
cschlosser.doxdocgen
davidanson.vscode-markdownlint
dbaeumer.vscode-eslint
dustypomerleau.rust-syntax
eamodio.gitlens
firsttris.vscode-jest-runner
george-alisson.html-preview-vscode
github.copilot
github.vscode-github-actions
gruntfuggly.todo-tree
guyskk.language-cython
hbenl.vscode-test-explorer
hediet.vscode-drawio
idleberg.innosetup
janisdd.vscode-edit-csv
jeff-hykin.better-cpp-syntax
jscearcy.rust-doc-viewer
lorenzopirro.rust-flash-snippets
lucono.karma-test-explorer
magicstack.magicpython
marp-team.marp-vscode
matklad.pale-fire
mgt19937.typst-preview
mhutchie.git-graph
monosans.djlint
ms-azuretools.vscode-docker
ms-ceintl.vscode-language-pack-fr
ms-python.black-formatter
ms-python.debugpy
ms-python.isort
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-toolsai.vscode-jupyter-cell-tags
ms-toolsai.vscode-jupyter-slideshow
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-wsl
ms-vscode.cmake-tools
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
ms-vscode.live-server
ms-vscode.makefile-tools
ms-vscode.remote-explorer
ms-vscode.test-adapter-converter
ms-vsliveshare.vsliveshare
nico-castell.linux-desktop-file
nvarner.typst-lsp
nyxiative.rust-and-friends
polymeilex.rust-targets
raymondcamden.languagetool
rifi2k.format-html-in-php
rust-lang.rust-analyzer
rvest.vs-code-prettier-eslint
samuelcolvin.jinjahtml
searking.preview-vscode
serayuzgur.crates
streetsidesoftware.code-spell-checker
streetsidesoftware.code-spell-checker-french
tshino.kb-macro
twxs.cmake
usernamehw.errorlens
vadimcn.vscode-lldb
visualstudioexptteam.intellicode-api-usage-examples
visualstudioexptteam.vscodeintellicode
vscode-icons-team.vscode-icons
wengerk.highlight-bad-chars
wholroyd.jinja
xyz.local-history
zhangyue.rust-mod-generator
zokugun.cron-tasks
zokugun.sync-settings

Any idea about how to configure VSCode to analyze the test modules as if cfg(test) is enabled ? Thanks !

rust-analyzer should already be doing that, unless you have modified the setting rust-analyzer.cargo.unsetTest.

Oh, so, I understand : This is because my crate name is core ! Thanks !

Aha. You should probably rename it — if I remember correctly, you will experience further problems due to the name conflict with the Rust standard library crate core.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.