Comments (2)
Hey @eduardoarandah, just wanted to let you know that #3 has been implemented and PHP should work a bit better now.
However, I still didn't get the injected CSS and JS working because it doesn't seem like they even get injected.
Anyways, if you manage to inject those languages, then the current solution should work 😄 I just couldn't figure out how to get the injection working.
Other than that, let me know if there are any other problems with PHP.
from nvim-ts-context-commentstring.
Hey! The tree that the PHP treesitter parser creates seems to be a bit weird and it doesn't seem to match the output in the treesitter playground.
For example, in this simple case, the playground shows the tags, but in reality, the HTML part is just text
(everything up to <?php
):
(I checked the current node under the cursor with :lua print(require'nvim-treesitter.ts_utils'.get_node_at_cursor(0):type())
)
This means that there is no container node that can be used as a check for this plugin. The only nodes are text
and program
.
However, if I add a PHP end tag (?>
), then there is a text_interpolation
node:
text_interpolation
seems like a good check for setting <!-- %s -->
.
Everything inside text_interpolation
is once again a text
node. This means that any style
or script
tags cannot be detected 😕
Also, if the PHP tag is wrapped in an HTML tag, then the parser will break:
This is the best result I managed to get:
Screen.Recording.2021-03-27.at.22.51.38.mov
I used this config:
php = {
text_interpolation = '<!-- %s -->',
},
And setlocal commentstring=//\ %s
in after/ftplugin/php.vim
I'm hoping that once #3 is implemented, we could use language tree to improve this.
from nvim-ts-context-commentstring.
Related Issues (20)
- Svelte only returns html-comment for all locations HOT 2
- Need help in debugging strange situation HOT 1
- Work-around to make this work with native comments in Neovim 0.10 HOT 4
- Incorrect commentstring for erb tags on eruby files
- Incorrect commentstring inside <?php ?> tags HOT 1
- Does not seems to work on html files like shown in the doc
- Add support for Neovim's built-in comments HOT 2
- Required fields in ts_context_commentstring.Config HOT 1
- vue style comment wrong HOT 3
- Vue comment not working properly HOT 2
- This plugin doesn't set the `comments` var. HOT 2
- BREAKING CHANGES HOT 6
- Incorrent commentstring for inline markdown code blocks HOT 4
- `set ft?` return `filetype=on` and causing losing syntax highlighting HOT 5
- Commenting is slow in large Markdown files HOT 2
- context_commentstring nvim-treesitter module is deprecated HOT 2
- tsx is not properly commenting even when ts-context-commentstring works HOT 1
- Please do not create unnecessary global variables
- Vue comment js/ts using html comment tags HOT 2
- Doesn't work ootb with mini.comment / Comment.nvim (React) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-ts-context-commentstring.