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

mix surface.convert tries to convert files that are commented out #649

Open
simonmcconnell opened this issue Sep 9, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@simonmcconnell
Copy link
Contributor

Describe the bug

I have a some_component.ex where the entire contents are commented out using #. mix surface.convert attempts to convert this file and crashes.

mix surface.convert failed for file: lib/logacy_web/components/dropdown_lv.ex
** (Surface.Compiler.ParseError) nofile:16:19: expected attribute name, got: `=`
    (surface 0.8.1) lib/surface/compiler/tokenizer.ex:531: Surface.Compiler.Tokenizer.handle_attribute/5
    (surface 0.8.1) lib/surface/compiler/converter.ex:18: Surface.Compiler.Converter.convert/2
    (surface 0.8.1) lib/mix/tasks/surface/surface.convert.ex:75: anonymous fn/5 in Mix.Tasks.Surface.Convert.convert_ex_string!/2
    (elixir 1.13.4) lib/regex.ex:739: Regex.apply_list/5
    (elixir 1.13.4) lib/regex.ex:734: Regex.apply_list/5
    (elixir 1.13.4) lib/regex.ex:669: Regex.replace/4    (elixir 1.13.4) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
    (surface 0.8.1) lib/mix/tasks/surface/surface.convert.ex:65: Mix.Tasks.Surface.Convert.convert_file_contents!/3

    (surface 0.8.1) lib/mix/tasks/surface/surface.convert.ex:118: Mix.Tasks.Surface.Convert.convert_file/3
    (elixir 1.13.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
    (elixir 1.13.4) lib/task/supervised.ex:34: Task.Supervised.reply/4
    (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

How to reproduce it

  1. comment out the entire contents of a surface component file.
  2. run mix surface.convert
  3. :*(

The behaviour you expected

Commented out lines/files are ignored.

Your Environment

Surface: v0.8.1
LiveView: v0.17.11
Elixir: v1.13.4

@Malian Malian added the bug Something isn't working label Sep 9, 2022
@Malian
Copy link
Collaborator

Malian commented Sep 9, 2022

I faced the same kind of issue with Sourceror, doorgan/sourceror#57, but in this case it seems that it is directly related to Surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants