microsoft / microsoft/TypeScript-TmLanguage

import declaration should not include semicolon or require line end

Open
#497 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

needs more info
Dominant language
TypeScript
Stars
471
Forks
149
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/Microsoft/vscode/issues/30527

The coffeescript grammar includes the JavaScript grammar.
With the following example:

`import Ember from 'ember'`
# foo bar baz
if true then console.log('qnx')

the JavaScript grammar is used to tokenize what's inside the backward quotes. Problem is that it does not return to the initial state after processing 'ember'. It expects a semicolon or the end of the line. Because of that, the JavaScript grammar scope remains and the rest of the file is colorized also with the JavaScipt grammar.

For supporting embedded cases like this, it would be great if the import declaration rule could end to end with the string literal or any non-expected symbol.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the import declaration rule in the grammar files and reproduce the embedded CoffeeScript example from the issue. Check how the JavaScript grammar handles the import string literal and returns to the surrounding grammar. Done means the embedded import stops at the string literal or another non-expected symbol, while the following CoffeeScript is no longer JavaScript-colored.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.