microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
915 stars 133 forks source link

File changes desynced leading to syntax errors #1929

Open Tadimsky opened 4 years ago

Tadimsky commented 4 years ago

Issue Type: Bug

Python is showing parsing errors on valid code.

image

image

Extension version: 2020.2.64397 VS Code version: Code 1.42.1 (c47d83b293181d9be64f27ff093689e8e7aed054, 2020-02-11T14:44:27.652Z) OS version: Darwin x64 19.3.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|4, 3, 3| |Memory (System)|16.00GB (3.20GB free)| |Process Argv|-psn_0_102425| |Screen Reader|no| |VM|0%|
jakebailey commented 4 years ago

I can't reproduce this. Can you give exactly the file up to those errors? Are you certain those parenthesis/commas aren't some unicode-variant Python cannot accept?

Tadimsky commented 4 years ago

If I close VS Code and open it again it's fine. So it's not something wrong with the file - the extension seems to sometimes get confused.

jakebailey commented 4 years ago

Still need the code to be able to try it out myself, as I still cannot reproduce it. Even if it's just the first 25 lines you show in the screenshot. See also https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#filing-an-issue

Tadimsky commented 4 years ago

Sure thing, here we go:

import json
from datetime import datetime

from log_config import logging
from metrics import Metrics

from .json_to_df import (
    accepted_carrier_job_columns,
    facilities_columns,
    hypothetical_carrier_job_columns,
    json_to_df,
    shipments_columns,
)
from .massage_raw_input import get_post_process_carrier_jobs, get_post_process_shipments
from .trip_metrics import (
    basic_summary_of_trip_outputs,
    metrics_comparing_trip_and_mp,
    basic_inputs_summary,
    summary_shape_of_marketplace_cjs,
    summary_trailer_counts,
)
from .trip_tools import (
    solve_from_dfs_to_trip_selections,
    write_selected_hypothetical_decisions,
)
Tadimsky commented 4 years ago

Here's another fun one I ran into:

image

Not sure where

unexpected token 'DETELPMOC_PUKCIPKCIPAMpickupCompleted' comes from.

jakebailey commented 4 years ago

This hints at buffer corruption, rather than an actual parser issue. The squiggle's bounds don't make any sense and that string is definitely wrong.

MikhailArkhipov commented 4 years ago

Probably another manifestation of #1009 which was mostly fixed, but I guess not entirely.

pjsg commented 4 years ago

This one is amazing:

image

And the errors are:

image

Note that the eman is name spelled backwards. eman_gol is log_name.

image