Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

?) confuses syntax highlighter #411

Open
onelesd opened this issue Mar 8, 2018 · 1 comment
Open

?) confuses syntax highlighter #411

onelesd opened this issue Mar 8, 2018 · 1 comment

Comments

@onelesd
Copy link

onelesd commented Mar 8, 2018

Similar to #185, ?) confuses the syntax highlighter. Escaping like ?\) does unbreak it. ?] also confuses it.

screen shot 2018-03-07 at 6 31 19 pm

@dgutov
Copy link
Contributor

dgutov commented Apr 27, 2019

This should be a more comprehensive fix:

diff --git a/elixir-mode.el b/elixir-mode.el
index b7426e1..980645f 100644
--- a/elixir-mode.el
+++ b/elixir-mode.el
@@ -277,9 +277,15 @@ is used to limit the scan."
     (goto-char start)
     (funcall
      (syntax-propertize-rules
-      ("\\(\\?\\)[\"']"
-       (1 (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0))))
-              ;; Within a string, skip.
+      ("\\(\\?\\)[][(){}\"']"
+       (1
+        (if (or
+             ;; Probably a part of function name.
+             (not (memq (char-before (match-beginning 0))
+                        '(nil ?\[ ?\s ?\( ?,)))
+             ;; Within a string.
+             (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))))
+              ;; So skip it.
               (ignore
                (goto-char (match-end 1)))
             (put-text-property (match-end 1) (match-end 0)

It will allow you to quote other important characters like all types of parens.

J3RN pushed a commit to J3RN/emacs-elixir that referenced this issue Apr 24, 2021
* Purge consolidated protocols before compilation

Fixes elixir-editors#395

* move to dialyzer_test.exs

* dialyzer_enabled? is already asserted at call site

* add argument type assertions

* return invalid_param when handling a request involving not open uri

* add tests for text synchronization

fixes some issues when certain sequence of notifications would create nil entries in source_files map

* warn when cancelling unknown request

* fix difference in watched extensions

* add tests to workspace/didChangeWatchedFiles

fix some consistency issues:
dirty? flag not updated when file modified outside (no didSave)
rebuild not triggered when opened dirty file modified outside

* add tests for SourceFile.apply_content_changes

based on https://github.com/microsoft/vscode-languageserver-node
fixes a few edge cases when dealing with invalid ranges

* add test

* add utf test

* add test

fix full_range invalid when last line with unicode

* fix apply_content_changes not preserving windows line endings

* wip

* do not warn if consolidation path does not exist

* fix tests

* return invalid_request

* handle invalid uri in async requests

* return invalid_request for not matched commands

* handle client request errors

* run formatter

* rename

* Refactor implementation of SourceFile.lines_with_endings

The previous implementation did not have any bugs (that I saw), but I
did find it more difficult to read and understand. I expect performance
to be comparable.

For more comprehensive testing I have added StreamData which adds
property-based testing. We can probably use that in other portions of
the code base as well.

* Update apps/language_server/test/source_file_test.exs

Co-authored-by: Jason Axelson <axelson@users.noreply.github.com>

* run formatter

* add disclaimer

* combine lines_with_endings test cases

Co-authored-by: Jason Axelson <jason.axelson@gmail.com>
Co-authored-by: Jason Axelson <axelson@users.noreply.github.com>
J3RN pushed a commit to J3RN/emacs-elixir that referenced this issue Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants