@@ -8,6 +8,7 @@ Table of contents:
8
8
1. SETUP: Install and setup the plugin. | love2d-setup |
9
9
2. COMMANDS: Commands provided by the plugin. | love2d-commands |
10
10
3. LSP: Explaining LSP support for LÖVE. | love2d-lsp |
11
+ 4. GLSL: Notes about GLSL and tree-sitter support. | love2d-glsl |
11
12
12
13
13
14
================================================================================
@@ -113,5 +114,44 @@ add the `love` namespace to the LSP.
113
114
For example, when placing the cursor over the `love` variable and pressing
114
115
`K` , you should see the documentation for the `love` namespace.
115
116
117
+
118
+ ================================================================================
119
+ GLSL *love2d-glsl*
120
+
121
+ OpenGL Shading Language (GLSL) is a high-level shading language for writing
122
+ shaders. Shaders are small programs which are run on the graphics card when
123
+ drawing. See https://www.love2d.org/wiki/love.graphics.newShader section
124
+ "Shader Language" for love2d specific aliases.
125
+
126
+ This plugin adds additional queries for | treesitter | to support inline GLSL in
127
+ specific places. For example when calling `love.graphics.newShader ()` .
128
+
129
+ For these queries to take effect you need to have `lua ` and `glsl` parsers
130
+ installed. Easiest way to do so is by using plugin `nvim- treesitter` from
131
+ github https://github.com/nvim-treesitter/nvim-treesitter . After installing
132
+ the plugin, you can run `:TSInstall lua glsl` to install parsers.
133
+
134
+ Doing so will enable neovim to "understand" that string inside
135
+ `love.graphics.newShader ()` is not just a string, but a `glsl` code. And you
136
+ will get:
137
+
138
+ 1. Syntax highlighting for inline shaders.
139
+ 2. If you have `Comment .nvim` , it will now properly comment inside shaders.
140
+ 3. Plugin `nvim- treesitter- textobjects` , now will work inside shaders.
141
+ 4. And any other plugin/feature that depends on treesitter.
142
+
143
+ If parsers are installed and plugin is loaded you should see the code below
144
+ properly highlighted! (you may have to execute | :edit | to refresh current file)
145
+
146
+ >lua
147
+ love.graphics.newShader([[
148
+ vec4 effect(vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords)
149
+ {
150
+ vec4 texturecolor = VideoTexel(texture_coords);
151
+ return texturecolor * color;
152
+ }
153
+ ]])
154
+ <
155
+
116
156
==============================================================================
117
157
vim:tw=78:ts=8:et:ft=help:norl:
0 commit comments