atom / language-python

Python package for Atom
Other
190 stars 146 forks source link

Add a lookahead for DELETE to avoid mistaking HTTP strings for SQL #315

Closed illright closed 3 years ago

illright commented 4 years ago

Description of the Change

Currently, the uppercase DELETE is a trigger to initiate coloring for embedded SQL. That comes into conflict with the HTTP request descriptions, where DELETE is one of the allowed methods.

So an API-describing string like:

"""
GET /endpoint
POST /endpoint
DELETE /endpoint
PATCH /endpoint
"""

starts getting wrong highlighting starting from the DELETE keyword. image

This PR aims to cover this particular case of the occurence of DELETE in a string.

Benefits

API descriptions in Python strings will look more appealing, and provided that servers are frequently written in Python, this is a considerable use case.

Possible Drawbacks

Looks a little hacky.

calebmeyer commented 3 years ago

Thanks for your submission!

We require automated tests for all pull requests that include new or changed code. We do this so that we can ensure that we don't accidentally break your shiny new code the next time we or some other contributor submits a change. If you need help writing automated tests for Atom, check out Discuss, the official Atom and Electron message board or join the Atom Slack team. There are a bunch of helpful community members that should be willing to point you in the right direction.

illright commented 3 years ago

@calebmeyer Could you please take a look at the latest failing build? I don't think it's failing because of my changes

darangi commented 3 years ago

Thanks @illright for your contribution,

The failure isn't related to your change, this is a problem with Travis service.