-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix intellisense on Windows #3082
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__INTELLISENSE__ is 1 on vs2022 and clang, causing FMT_HAS_INCLUDE, FMT_USE_FCNTL, etc to be 0. That results in VS and VSCode having a lot of linter errors while code compiles just fine.
Please post the errors here for future reference. |
Tested ide/editor, compiler:
windows os version: 10.0.25192.1000 CMakeLists.txt cmake_minimum_required(VERSION 3.20)
project(reproducible)
add_subdirectory(fmt-9.1.0)
add_executable(reproducible main.cpp)
set_target_properties(reproducible PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON)
target_link_libraries(reproducible PRIVATE fmt::fmt) main.cpp #include <fmt/core.h>
#include <fmt/os.h>
#include <fmt/std.h>
int main() {
fmt::ostream stream = fmt::output_file("test.log");
stream.print("test : {}", std::time(0));
using variant_test = std::variant<std::monostate, std::string>;
variant_test default_;
variant_test string_ = "World";
fmt::print("Hello, {}!\n", default_);
fmt::print("Hello, {}!\n", string_);
} Build: successful
test.log:
Example intellisense output (VSCode, clang 14.0.6):Reason for errors:
[{
"resource": "/d:/Users/Administrator/Desktop/fmt-test/fmt-9.1.0/include/fmt/std.h",
"owner": "C/C++",
"code": "3365",
"severity": 8,
"message": "incomplete class type \"std::filesystem::path\" is not allowed",
"source": "C/C++",
"startLineNumber": 44,
"startColumn": 12,
"endLineNumber": 44,
"endColumn": 13
},{
"resource": "/d:/Users/Administrator/Desktop/fmt-test/fmt-9.1.0/include/fmt/std.h",
"owner": "C/C++",
"code": "70",
"severity": 8,
"message": "incomplete type is not allowed",
"source": "C/C++",
"startLineNumber": 51,
"startColumn": 32,
"endLineNumber": 51,
"endColumn": 65
},{
"resource": "/d:/Users/Administrator/Desktop/fmt-test/fmt-9.1.0/include/fmt/std.h",
"owner": "C/C++",
"code": "70",
"severity": 8,
"message": "incomplete type is not allowed",
"source": "C/C++",
"startLineNumber": 52,
"startColumn": 25,
"endLineNumber": 52,
"endColumn": 58
},{
"resource": "/d:/Users/Administrator/Desktop/fmt-test/fmt-9.1.0/include/fmt/std.h",
"owner": "C/C++",
"code": "135",
"severity": 8,
"message": "namespace \"std\" has no member \"variant_size\"",
"source": "C/C++",
"startLineNumber": 107,
"startColumn": 54,
"endLineNumber": 107,
"endColumn": 66
},{
"resource": "/d:/Users/Administrator/Desktop/fmt-test/fmt-9.1.0/include/fmt/std.h",
"owner": "C/C++",
"code": "254",
"severity": 8,
"message": "type name is not allowed",
"source": "C/C++",
"startLineNumber": 107,
"startColumn": 67,
"endLineNumber": 107,
"endColumn": 68
},{
"resource": "/d:/Users/Administrator/Desktop/fmt-test/fmt-9.1.0/include/fmt/std.h",
"owner": "C/C++",
"code": "282",
"severity": 8,
"message": "the global scope has no \"value\"",
"source": "C/C++",
"startLineNumber": 107,
"startColumn": 71,
"endLineNumber": 107,
"endColumn": 76
},{
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp",
"owner": "C/C++",
"code": "135",
"severity": 8,
"message": "namespace \"fmt\" has no member \"ostream\"",
"source": "C/C++",
"startLineNumber": 6,
"startColumn": 10,
"endLineNumber": 6,
"endColumn": 17
},{
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp",
"owner": "C/C++",
"code": "135",
"severity": 8,
"message": "namespace \"fmt\" has no member \"output_file\"",
"source": "C/C++",
"startLineNumber": 6,
"startColumn": 32,
"endLineNumber": 6,
"endColumn": 43
},{
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp",
"owner": "C/C++",
"code": "135",
"severity": 8,
"message": "namespace \"std\" has no member \"variant\"",
"source": "C/C++",
"startLineNumber": 9,
"startColumn": 31,
"endLineNumber": 9,
"endColumn": 38
},{
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp",
"owner": "C/C++",
"code": "65",
"severity": 8,
"message": "expected a ';'",
"source": "C/C++",
"startLineNumber": 9,
"startColumn": 38,
"endLineNumber": 9,
"endColumn": 39
},{
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp",
"owner": "C/C++",
"code": "304",
"severity": 8,
"message": "no instance of overloaded function \"fmt::print\" matches the argument list",
"source": "C/C++",
"startLineNumber": 13,
"startColumn": 5,
"endLineNumber": 13,
"endColumn": 8,
"relatedInformation": [
{
"startLineNumber": 13,
"startColumn": 5,
"endLineNumber": 13,
"endColumn": 8,
"message": "argument types are: (const char [12], variant_test)",
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp"
}
]
},{
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp",
"owner": "C/C++",
"code": "304",
"severity": 8,
"message": "no instance of overloaded function \"fmt::print\" matches the argument list",
"source": "C/C++",
"startLineNumber": 14,
"startColumn": 5,
"endLineNumber": 14,
"endColumn": 8,
"relatedInformation": [
{
"startLineNumber": 14,
"startColumn": 5,
"endLineNumber": 14,
"endColumn": 8,
"message": "argument types are: (const char [12], variant_test)",
"resource": "/D:/Users/Administrator/Desktop/fmt-test/main.cpp"
}
]
}] |
Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
__INTELLISENSE__
is 1 on vs2022 and clang, causing FMT_HAS_INCLUDE, FMT_USE_FCNTL, etc to be 0.That results in VS and VSCode having a lot of linter errors while code compiles just fine.
Removing
&& !defined(__INTELLISENSE__)
fixes these problems.