Skip to content

Expand the reach of keyword typo suggestions #156092

Description

@johnslavik

Feature or enhancement

Keyword typo suggestions won't work for most realistically big source files, because

  1. we have a cap of 1024 characters of the source we recompile for probing
  2. most Python source files in practice are rather bigger

My idea is to try to shrink the source being recompiled for probing keyword typos by cutting the smallest possible window of the full source. The center of the window would be in the SyntaxError reported line and offset. The window would be bounded by empty lines (most people do format code this way) and the window would have to start with a line that does not have an indent as the first token.

As a result, keyword typo suggestions could have way further reach for realistic cases.

I might include more illustrations later. cc @pablogsal

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions