Skip to content
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

two different colors for the equal sign. #791

Closed
Xinyu-Sheng opened this issue Jul 4, 2023 · 8 comments
Closed

two different colors for the equal sign. #791

Xinyu-Sheng opened this issue Jul 4, 2023 · 8 comments
Labels
bug WIP Work In Process

Comments

@Xinyu-Sheng
Copy link

Describe the bug
In the display of a C++ file, there are two different colors for the equal sign.

Screenshots & Example Code
image

Desktop (please complete the following information):

  • OS: Windows 11
  • VSCODE Version 1.79.2
  • Theme version 3.15.18
@Xinyu-Sheng Xinyu-Sheng added the bug label Jul 4, 2023
@Binaryify
Copy link
Owner

could you provide more code
image

@Xinyu-Sheng
Copy link
Author

Xinyu-Sheng commented Jul 7, 2023

the code comes from ROS2
Writing a simple publisher and subscriber (C++)Writing a simple publisher and subscriber (C++)

#include <chrono>
#include <functional>
#include <memory>
#include <string>

#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"

using namespace std::chrono_literals;

/* This example creates a subclass of Node and uses std::bind() to register a
* member function as a callback from the timer. */

class MinimalPublisher : public rclcpp::Node
{
  public:
    MinimalPublisher()
    : Node("minimal_publisher"), count_(0)
    {
      publisher_ = this->create_publisher<std_msgs::msg::String>("topic", 10);
      timer_ = this->create_wall_timer(
      500ms, std::bind(&MinimalPublisher::timer_callback, this));
    }

  private:
    void timer_callback()
    {
      auto message = std_msgs::msg::String();
      message.data = "Hello, world! " + std::to_string(count_++);
      RCLCPP_INFO(this->get_logger(), "Publishing: '%s'", message.data.c_str());
      publisher_->publish(message);
    }
    rclcpp::TimerBase::SharedPtr timer_;
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_;
    size_t count_;
};

int main(int argc, char * argv[])
{
  rclcpp::init(argc, argv);
  rclcpp::spin(std::make_shared<MinimalPublisher>());
  rclcpp::shutdown();
  return 0;
}

image

@Binaryify
Copy link
Owner

can't reproduce in vscode 1.80.0
image

@Xinyu-Sheng
Copy link
Author

Xinyu-Sheng commented Jul 12, 2023

Perhaps you should try using a computer with ROS2 installed, which includes the necessary header files that can be located. The following image is taken in vscode 1.80.0
image
Perhaps the issue is related to the "inline" keyword:
image

@Binaryify Binaryify added the WIP Work In Process label Jul 18, 2023
@Binaryify
Copy link
Owner

could you use this command to show the code's scope
image
image
image

@Xinyu-Sheng
Copy link
Author

image
image

@Binaryify
Copy link
Owner

plz try v3.16.0

@Xinyu-Sheng
Copy link
Author

Problem solved! Thanks for your effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug WIP Work In Process
Projects
None yet
Development

No branches or pull requests

2 participants