Repository: TypeScript
Issue: Semantic tokenizer thinks a class method is a class if it does not use method shorthand and it defines a property on the class instance
Labels: Bug,Help Wanted

Type: <b>Bug</b>

Let me know if this is in the wrong place. I tried putting it under the JS/TS nightly extension, but apparently that just toggles a flag to enable a built-in feature.

Open the example below in vscode to see the issue. func1, func2, and func3 are all methods. But depending on how they are declared and whether they define a property, they can be tokenized as methods or as classes.

Test1 shows how all of these methods should be tokenized (as methods), regardless of what properties they define.

Test2 shows how this gets messed up. func1 is fine because, even though it is not defined with ES6 shorthand, it doesn't set any properties, so vscode doesn't think it's a class. func2 is tokenized as a class, apparently because it has a property definition within. And func3 is tokenized as a method because although it has a property definition, it is defined with the method shorthand.

Test3 just shows that it doesn't matter whether we use an ES6 class or an old school constructor function.

```js
class Test1 {
  func1() {
    this.func2();
  }
  func2() {
    this.msg = "Hello, world!";
    this.func3();
  }
  func3() {
    this.msg = "Goodbye, cruel world!";
  }
}

class Test2 {
  func1 = function func1() {
    this.func2();
  };
  func2 = function func2() {
    this.msg = "Hello, world!";
    this.func3();
  };
  func3() {
    this.msg = "Goodbye, cruel world!";
  }
}

function Test3() {}
Test3.prototype = {
  func1: function func1() {
    this.func2();
  },
  func2: function func2() {
    this.msg = "Hello, world!";
    this.func3();
  },
  func3() {
    this.msg = "Goodbye, cruel world!";
  },
};
```

VS Code version: Code 1.72.0 (64bbfbf67ada9953918d72e1df2f4d8e537d340e, 2022-10-04T23:20:39.912Z)
OS version: Windows_NT x64 10.0.19043
Modes:
Sandboxed: No

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|AMD Ryzen 9 5950X 16-Core Processor             (32 x 3400)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|undefined|
|Memory (System)|63.95GB (31.02GB free)|
|Process Argv|--crash-reporter-id e22b8142-1ce4-45d4-9ef1-b76c17f0930d|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (76)</summary>

Extension|Author (truncated)|Version
---|---|---
vscode-userscript|adp|1.3.2
rtf|ale|2.6.1
change-color-format|bbu|1.2.0
vscode-icontheme-nomo-dark|be5|1.3.6
npm-intellisense|chr|1.4.2
codeswing|cod|0.0.21
doxdocgen|csc|1.4.0
ini-for-vscode|Dav|0.0.4
vscode-eslint|dba|2.2.6
xml|Dot|2.5.1
gitlens|eam|12.2.2
vscode-html-css|ecm|1.13.1
vsc-material-theme|Equ|33.5.0
vsc-material-theme-icons|equ|2.4.0
prettier-vscode|esb|9.9.0
comment-anchors|Exo|1.9.6
vscode-firefox-debug|fir|2.9.8
auto-rename-tag|for|0.1.10
shell-format|fox|7.2.2
copilot|Git|1.50.6974
remotehub|Git|0.44.0
vscode-pull-request-github|Git|0.50.0
renumber-selection|Gru|0.0.5
AlwaysOpenWorkspace|Hai|0.10.0
beautify|Hoo|1.5.0
vscode-psl|ing|1.11.4
reg|ion|1.1.0
better-cpp-syntax|jef|1.16.1
svg|joc|1.4.20
bracket-peek|jom|1.4.4
minifyall|jos|2.10.0
vscode-colorize|kam|0.11.1
auto-comment-blocks|kev|1.0.1
vscode-lua-format|Koi|1.3.8
vs-color-picker|lih|1.0.0
vscode-clangd|llv|0.1.21
vscode-fluent|mac|1.0.0
hex-rgba-converter|med|1.0.4
template-string-converter|meg|0.6.0
code-beautifier|mic|2.3.3
hg|mrc|1.8.1
vscode-autoprefixer|mrm|3.0.1
vscode-csscomb|mrm|5.3.2
python|ms-|2022.16.0
vscode-pylance|ms-|2022.10.10
remote-containers|ms-|0.255.2
remote-ssh|ms-|0.84.0
remote-wsl|ms-|0.72.0
cpptools|ms-|1.12.4
cpptools-extension-pack|ms-|1.3.0
remote-repositories|ms-|0.22.0
vscode-typescript-next|ms-|4.9.20221006
idl|myt|0.3.1
vscode-xyplorer|Oti|0.2.1
vscode-css-variables-autocomplete|par|0.3.1
subtitles-editor|pep|1.1.7
material-icon-theme|PKi|4.20.0
vscode-autohotkey-plus-slimcode|raf|2.1.18
file-bunny|rob|1.3.1
wikitext|Row|3.6.5
html5-boilerplate|sid|1.1.1
shader|sle|1.1.5
create-boilerplate|Squ|1.0.0
rewrap|stk|1.16.3
vscode-stylelint|sty|1.2.3
sass-indented|syl|1.8.22
es6-string-html|Tob|2.12.0
workspace-explorer|tom|2.3.0
simple-rst|tro|1.5.2
intellicode-api-usage-examples|Vis|0.2.4
vscodeintellicode|Vis|1.2.28
quokka-vscode|Wal|1.0.504
ws-rainmeter|wil|0.2.7
JavaScriptSnippets|xab|1.8.0
material-theme|zhu|3.15.5
es6-string-javascript|zjc|1.0.1

(6 theme extensions excluded)

</details>
<!-- generated by issue reporter -->