From fc5ce4739cbe66d2bbd0cda4b20bcb5ba226de10 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 12 Nov 2020 15:05:01 +0200 Subject: [PATCH] Added an error selector for `Sublime Text` build runner // Resolve #3733 --- HISTORY.rst | 2 ++ platformio/ide/tpls/emacs/.ccls.tpl | 2 +- platformio/ide/tpls/sublimetext/.ccls.tpl | 22 ++++++++++++ .../platformio.sublime-project.tpl | 34 ++++++++----------- 4 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 platformio/ide/tpls/sublimetext/.ccls.tpl diff --git a/HISTORY.rst b/HISTORY.rst index a96d3dc2..8ede7429 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,7 +11,9 @@ PlatformIO Core 5 5.0.3 (2020-??-??) ~~~~~~~~~~~~~~~~~~ +- Added an error selector for `Sublime Text `__ build runner (`issue #3733 `_) - Generate a working "projectEnvName" for PlatformIO IDE's debugger for VSCode +- Force VSCode's intelliSenseMode to "gcc-x64" when GCC toolchain is used 5.0.2 (2020-10-30) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/ide/tpls/emacs/.ccls.tpl b/platformio/ide/tpls/emacs/.ccls.tpl index b6d7d55a..232d2f8d 100644 --- a/platformio/ide/tpls/emacs/.ccls.tpl +++ b/platformio/ide/tpls/emacs/.ccls.tpl @@ -4,7 +4,7 @@ % cxx_stds = STD_RE.findall(cxx_flags) % % -clang +{{ cxx_path }} % if cc_stds: {{"%c"}} -std=c{{ cc_stds[-1] }} diff --git a/platformio/ide/tpls/sublimetext/.ccls.tpl b/platformio/ide/tpls/sublimetext/.ccls.tpl new file mode 100644 index 00000000..232d2f8d --- /dev/null +++ b/platformio/ide/tpls/sublimetext/.ccls.tpl @@ -0,0 +1,22 @@ +% import re +% STD_RE = re.compile(r"\-std=[a-z\+]+(\w+)") +% cc_stds = STD_RE.findall(cc_flags) +% cxx_stds = STD_RE.findall(cxx_flags) +% +% +{{ cxx_path }} + +% if cc_stds: +{{"%c"}} -std=c{{ cc_stds[-1] }} +% end +% if cxx_stds: +{{"%cpp"}} -std=c++{{ cxx_stds[-1] }} +% end + +% for include in filter_includes(includes): +-I{{ include }} +% end + +% for define in defines: +-D{{ define }} +% end diff --git a/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl b/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl index 160cd6ba..2b5d61d4 100644 --- a/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl +++ b/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl @@ -5,9 +5,10 @@ "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "run" ], + "file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$", "name": "PlatformIO", "variants": [ @@ -15,78 +16,73 @@ "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "run" ], + "file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$", "name": "Build" }, { "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "run", "--target", "upload" ], + "file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$", "name": "Upload" }, { "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "run", "--target", "clean" ], + "file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$", "name": "Clean" }, { "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "test" ], + "file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$", "name": "Test" }, { "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", - "run", - "--target", - "program" - ], - "name": "Upload using Programmer" - }, - { - "cmd": - [ - "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "run", "--target", "uploadfs" ], + "file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$", "name": "Upload SPIFFS image" }, { "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "update" ], + "file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$", "name": "Update platforms and libraries" }, { "cmd": [ "{{ platformio_path }}", - "-f", "-c", "sublimetext", + "-c", "sublimetext", "upgrade" ], "name": "Upgrade PlatformIO Core"