jeff-hykin / better-cpp-syntax

💾 The source of VS Code's C++ syntax highlighting
GNU General Public License v3.0
155 stars 30 forks source link

noexcept getting different scopes #504

Open alexr00 opened 4 years ago

alexr00 commented 4 years ago

Checklist

The code with a problem is:

#pragma once

#include "../StandardIncludes.h"

class FillComponent : public juce::Component {
  public:
    explicit FillComponent(juce::Colour color) noexcept;

    auto paint(juce::Graphics& g) noexcept -> void override;

    inline auto setColor(juce::Colour color) noexcept -> void {
        mColour = color;
    }

    inline auto getColour() const noexcept -> juce::Colour { // The noexcept on this line gets a different scope
        return mColour;
    }

#if defined(PACE_ENABLED)
    DECLARE_SECURITY_FUNCTIONS();
#endif

  private:
    juce::Colour mColour;

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FillComponent)
};

It looks like:

The noexcept on the line with the comment gets the following scopes: variable.other.object.access.cpp meta.head.function.definition.cpp meta.function.definition.cpp meta.body.class.cpp meta.block.class.cpp source.cpp

However, the other noexcepts have these scopes: keyword.operator.noexcept.cpp keyword.operator.wordlike.cpp meta.head.function.definition.cpp meta.function.definition.cpp meta.body.class.cpp meta.block.class.cpp source.cpp

image

It should look like:

I would expect all noexcepts to have the same or similar scopes. However, I am not expert on noexcept.

Originally from @braxtons12 in https://github.com/microsoft/vscode/issues/107172