No difference between single and double quoted strings

オープン
#172 コメント 1 件 リアクション 2 件 担当者 1 名 GitHub で見る

@vpetrovykh がすでに取り組んでいます。

2019年2月4日 から。

評価

この issue はまだ評価されていません。

説明

Ok I'm sorry if I don't take the time to use your template and try to prepare a pull request and all that stuff. I'm just not used to it.

I already spent much time on solving the issue for myself. And I only post here to share my solution.

If somebody is experimented with pull requests and all those things, below is my diff.

Also, if anybody finds this issue from google they will have the option to just apply the diff.

SOLUTION

Put the fix-string-quoted-double.patch (file below) in the relevant location of the extension.
Should be something like ~/.vscode/extensions/magicstack.magicpython-1.1.0/grammars/src

Then go to this location and execute git apply fix-string-quoted-double.patch

fix-string-quoted-double.patch

diff --git a/MagicPython.syntax.yaml b/MagicPython.syntax.yaml
index f885059..c6f6ae4 100644
--- a/MagicPython.syntax.yaml
+++ b/MagicPython.syntax.yaml
@@ -86,7 +86,7 @@ repository:
 
     - file: 'regexp.wrapper.syntax.yaml'
       vars:
-        scopename: string.regexp.quoted.single.python
+        scopename: string.regexp.quoted.double.python
         prefix: 'double-one-'
         basename: 'regexp'
         nested: ''
@@ -160,7 +160,7 @@ repository:
 
     - file: 'regexp.wrapper.syntax.yaml'
       vars:
-        scopename: string.regexp.quoted.single.python
+        scopename: string.regexp.quoted.double.python
                    string.interpolated.python
         prefix: 'double-one-'
         basename: 'fregexp'
@@ -183,7 +183,13 @@ repository:
     - file: 'pystring.inc.syntax.yaml'
       vars:
         line: single
-        marker: (['"])
+        marker: "'"
+        guard: "|((?<!\\\\)\\n)"
+
+    - file: 'pystring.inc.syntax.yaml'
+      vars:
+        line: double
+        marker: '"'
         guard: "|((?<!\\\\)\\n)"
 
     - file: 'pystring.inc.syntax.yaml'
@@ -195,7 +201,14 @@ repository:
     - file: 'pyfstring.inc.syntax.yaml'
       vars:
         line: single
-        marker: (['"])
+        marker: "'"
+        fguard: "|(?=\\n)"
+        guard: "|((?<!\\\\)\\n)"
+
+    - file: 'pyfstring.inc.syntax.yaml'
+      vars:
+        line: double
+        marker: '"'
         fguard: "|(?=\\n)"
         guard: "|((?<!\\\\)\\n)"
 
@@ -666,18 +679,25 @@ repository:
   string:
     patterns:
       - include: '#string-quoted-multi-line'
+      - include: '#string-quoted-double-line'
       - include: '#string-quoted-single-line'
       - include: '#string-bin-quoted-multi-line'
+      - include: '#string-bin-quoted-double-line'
       - include: '#string-bin-quoted-single-line'
       - include: '#string-raw-quoted-multi-line'
+      - include: '#string-raw-quoted-double-line'
       - include: '#string-raw-quoted-single-line'
       - include: '#string-raw-bin-quoted-multi-line'
+      - include: '#string-raw-bin-quoted-double-line'
       - include: '#string-raw-bin-quoted-single-line'
       - include: '#fstring-fnorm-quoted-multi-line'
+      - include: '#fstring-fnorm-quoted-double-line'
       - include: '#fstring-fnorm-quoted-single-line'
       - include: '#fstring-normf-quoted-multi-line'
+      - include: '#fstring-normf-quoted-double-line'
       - include: '#fstring-normf-quoted-single-line'
       - include: '#fstring-raw-quoted-multi-line'
+      - include: '#fstring-raw-quoted-double-line'
       - include: '#fstring-raw-quoted-single-line'
 
   string-unicode-guts:
主要言語
JavaScript
スター
1.4k
フォーク
98
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MagicStack/MagicPython のほかの issue

MagicStack/MagicPython の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。