microsoft / microsoft/vscode-textmate
Misclassification of PHP syntax tokens
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Type: Bug
VSCode assigns the wrong TextMate scope to several built-in PHP functions. The following functions are classified as entity.name.function.php instead of their corresponding support.function scope.
hrtime(); //should be support.function.datetime.php
stream_context_set_options(); //should be support.function.streamsfuncs.php
mysqli_connect_error(); //should be support.function.mysqli.php
mysqli_connect_errno(); //should be support.function.mysqli.php
mysqli_affected_rows(); //should be support.function.mysqli.php
mysqli_stmt_error(); //should be support.function.mysqli.php
mysqli_error(); //should be support.function.mysqli.php
mysqli_errno(); //should be support.function.mysqli.php
The issue is that entity.name.function.php means that a function is user defined and might have a different color than support.function.* which is a built-in function. If we indeed use a different color and add similar built-in functions the issue becomes more apparent:
stream_context_set_params(); //correct
stream_context_get_params(); //correct
stream_context_set_options(); //incorrect
stream_context_get_options(); //correct
time(); //correct
microtime(); //correct
hrtime(); //incorrect
sleep(); //correct
usleep(); //correct
mysqli_report(); //correct
mysqli_connect(); //correct
mysqli_query(); //correct
mysqli_fetch_row(); //correct
mysqli_fetch_assoc(); //correct
mysqli_affected_rows(); //incorrect
mysqli_stmt_error(); //incorrect
mysqli_error(); //incorrect
mysqli_errno(); //incorrect
mysqli_stmt_close(); //correct
mysqli_close(); //correct
It seems possible that there are further built-in functions that are misclassified, these are merely the ones that I encountered.
VS Code version: Code 1.80.0 (Universal) (660393deaaa6d1996740ff4880f1bad43768c814, 2023-07-04T13:39:33.766Z)
OS version: Darwin arm64 22.5.0
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Apple M2 Pro (10 x 24) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
| Load (avg) | 1, 1, 2 |
| Memory (System) | 16.00GB (0.36GB free) |
| Process Argv | --crash-reporter-id 1f82bd8c-3d7a-4311-b217-05e34a61785c |
| Screen Reader | no |
| VM | 0% |
Extensions (1)
| Extension | Author (truncated) | Version |
|---|---|---|
| vscode-eslint | dba | 2.4.2 |
(1 theme extensions excluded)
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263cf:30784848
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
03d35959:30757346
57b77579:30736110
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30785052
pythongtdpath:30769146
i26e3531:30780429
pythonnosmt12:30779714
pythonidxpt:30784022
pythonnocebcf:30776496
e537b577:30786199
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the listed PHP functions and their expected support.function.* scopes as the starting cases; inspect the grammar rules that classify them and compare them with the neighboring correctly classified functions named in the report. Done when the listed functions no longer receive entity.name.function.php and scope checks confirm the expected built-in scopes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100