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

M - ; comments not closing #589

Closed
seanareed opened this issue Sep 21, 2015 · 11 comments
Closed

M - ; comments not closing #589

seanareed opened this issue Sep 21, 2015 · 11 comments

Comments

@seanareed
Copy link

I recently upgraded web-mode.

I use it with PHP, and love it.

Since then, the M - ; shortcut for comments doesn't close those comments in a PHP block within web-mode.

Is it possible that this is due to a change in web-mode?

I'm attaching images of what it used to do and what it does now.

Thanks,
Sean

old

now

@fxbois
Copy link
Owner

fxbois commented Sep 21, 2015

@seanareed I do not plan to provide this kind of comments ... perhaps someone could provide a function (ask on stackoverflow)

@seanareed
Copy link
Author

Ok. Thanks. I may take a stab at it myself. Cheers, S

@itkach
Copy link

itkach commented Sep 25, 2015

It also does this now when editing javascript too. If I set web-mode-set-content-type to jsx in js buffer then it closes the comment properly.

@seanareed
Copy link
Author

Thanks!
That works for me too!

Is there a way to add something to the init file that automatically sets this on opening php files?

@fxbois fxbois closed this as completed Oct 2, 2015
@itkach
Copy link

itkach commented Oct 2, 2015

Setting wrong content type on a buffer is a useful workaround, but this is still broken, inserts /*. Should this issue really be closed?
Ideally, for javascript it should be // (these can be nested while multi-line comments can't be).

@fxbois
Copy link
Owner

fxbois commented Oct 2, 2015

as I wrote in my first comment, I do not plan to work on this. Perhaps someone could write a minor mode to handle this

@jasondf
Copy link

jasondf commented Oct 7, 2015

Well, I got the same issue, and try to do a stab myself, lucky me it works. Here is the screenshot:
screen shot 2015-10-08 at 01 17 48
Now M-; works in PHP file and php block in HTML file. Although I don't know if there is any side effects.

@seanareed
Copy link
Author

I looked at the diffs from the commit to web-mode.el on 15-Sep-2015 ('jsx commenting'), which is when I noticed the change in behavior.

The original code had a (not ) that is missing in the new code.

I don't know if this was intentional or an oversight.

However, adding that (not ) back in returns the proper closing behavior that was present before.

not

Changing line 8302 in the added code (green) to (not (string= alt "/*"))) remedies the issue for me.

-S

@seanareed
Copy link
Author

(...however, I have to evaluate the web-mode.el buffer for it to take effect.)

@seanareed
Copy link
Author

(...ah, yes... the .el library must be byte-compiled first... there is an .elc version.)

@jasondf
Copy link

jasondf commented Oct 8, 2015

@seanareed it works for me, thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants