better-cpp-syntax icon indicating copy to clipboard operation
better-cpp-syntax copied to clipboard

Issue with "delete"

Open rianquinn opened this issue 5 years ago • 5 comments

Checklist

  • [x] This problem exists even with the setting "C_Cpp.enhancedColorization": "Disabled"
  • [ ] This bug exists for C
  • [x] This bug exists for C++
  • [ ] This bug exists for Objective-C
  • [ ] This bug exists for Objective-C++

The code with a problem is:

unique_dynarray(const unique_dynarray &) = delete;
unique_dynarray &
operator=(const unique_dynarray &) = delete;

It looks like:

** screenshot + theme name preferable ** image

It should look like:

The "delete" keyword should be the same color for both

rianquinn avatar Oct 21 '19 14:10 rianquinn

This is likely an issue with your color theme.

The delete on line one is correctly recognized and has the scope keyword.other.delete.constructor.

The delete on line one is correctly recognized and has the scope keyword.operator.delete. (@jeff-hykin is that expected?)

You can use the vscode setting editor.tokenColorCustomizations to change the coloring for the tokens. For more information on how to do this see #7 or the visual studio code docs.

Alternatively, if you feel that this behavior should be fixed by default, you may wish to file an issue with your color-theme.

matter123 avatar Oct 21 '19 16:10 matter123

He is actually correct, there is a highlighting issue

class unique_dynarray {
    public:
    unique_dynarray(const unique_dynarray &) = delete;
    unique_dynarray &
    operator=(const unique_dynarray &) = delete;
}

Screen Shot 2019-10-22 at 8 53 38 AM

Both of them should be keyword.other.delete (light blue) since they're not operators (purple).

jeff-hykin avatar Oct 22 '19 13:10 jeff-hykin

This seems to arise with default, too. If you replace delete with default, the same colourisation occurs.

MonaTheMonad avatar Oct 24 '19 00:10 MonaTheMonad

image maybe you can try to use my theme. https://marketplace.visualstudio.com/items?itemName=peaceshi.syntax-highlight

or added this with the color you like:

keyword.operator { "fontStyle": "", "foreground": "#f07178" },
keyword.other.delete { "fontStyle": "", "foreground": "#f07178" }

peaceshi avatar Dec 22 '19 15:12 peaceshi

We got a similar report at https://github.com/microsoft/vscode-cpptools/issues/5715, with the additional issue with "default" on the operator having scope keyword.control.default.cpp (it's not a control flow "default"). Repro is

struct Test {
    Test(Test&) = default;
    Test(Test&&) = delete;
    Test& operator=(const Test &) = default;
    Test& operator=(Test&&) = delete;
};

sean-mcmanus avatar Jun 30 '20 22:06 sean-mcmanus

Should be fixed now (v1.15.24 released just now), but let me know if it persists

jeff-hykin avatar Oct 06 '22 14:10 jeff-hykin