-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Предраг Николић <[email protected]>
- Loading branch information
1 parent
d9efc4b
commit 7460b5c
Showing
13 changed files
with
371 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: /language-server | ||
schedule: | ||
interval: daily | ||
time: "11:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ | ||
{ | ||
"caption": "Preferences: LSP-twiggy Settings", | ||
"command": "edit_settings", | ||
"args": { | ||
"base_file": "${packages}/LSP-twiggy/LSP-twiggy.sublime-settings", | ||
"default": "// Settings in here override those in \"LSP-twiggy/LSP-twiggy.sublime-settings\"\n\n{\n\t$0\n}\n", | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"settings": { | ||
"twiggy.autoInsertSpaces": true, | ||
"twiggy.inlayHints.macroArguments": true, | ||
"twiggy.inlayHints.macro": true, | ||
"twiggy.inlayHints.block": true, | ||
"twiggy.phpExecutable": "php", | ||
"twiggy.framework": "ignore", | ||
"twiggy.symfonyConsolePath": "bin/console" | ||
}, | ||
// File watching functionality only works with "LSP-file-watcher-chokidar" package installed. | ||
"file_watcher": { | ||
"patterns": [ | ||
"**/*.twig" | ||
] | ||
}, | ||
"command": ["${node_bin}", "${server_path}", "--stdio"], | ||
"selector": "text.html.twig" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[ | ||
{ | ||
"id": "preferences", | ||
"children": [ | ||
{ | ||
"caption": "Package Settings", | ||
"mnemonic": "P", | ||
"id": "package-settings", | ||
"children": [ | ||
{ | ||
"caption": "LSP", | ||
"id": "lsp-settings", | ||
"children": [ | ||
{ | ||
"caption": "Servers", | ||
"id": "lsp-servers", | ||
"children": [ | ||
{ | ||
"caption": "LSP-twiggy", | ||
"command": "edit_settings", | ||
"args": { | ||
"base_file": "${packages}/LSP-twiggy/LSP-twiggy.sublime-settings", | ||
"default": "// Settings in here override those in \"LSP-twiggy/LSP-twiggy.sublime-settings\"\n\n{\n\t$0\n}\n", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# LSP-twiggy | ||
|
||
Twig support for Sublime’s LSP. | ||
|
||
Provided through [twiggy-language-server](https://github.com/moetelo/twiggy/tree/master/packages/language-server). | ||
|
||
### Installation | ||
|
||
* Install [LSP](https://packagecontrol.io/packages/LSP), [Twig Syntax](https://packagecontrol.io/packages/Twig) and [LSP-twiggy](https://packagecontrol.io/packages/LSP-twiggy) via Package Control. | ||
* Restart Sublime. | ||
|
||
### Configuration | ||
|
||
There are some ways to configure the package and the language server. | ||
|
||
- From `Preferences > Package Settings > LSP > Servers > LSP-twiggy` | ||
- From the command palette `Preferences: LSP-twiggy Settings` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"*": { | ||
"*": [ | ||
"lsp_utils", | ||
"sublime_lib" | ||
] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "twiggy", | ||
"private": true, | ||
"dependencies": { | ||
"twiggy-language-server": "^0.16.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from lsp_utils import NpmClientHandler | ||
import os | ||
|
||
|
||
def plugin_loaded(): | ||
LspTwigPlugin.setup() | ||
|
||
|
||
def plugin_unloaded(): | ||
LspTwigPlugin.cleanup() | ||
|
||
|
||
class LspTwigPlugin(NpmClientHandler): | ||
package_name = __package__ | ||
server_directory = 'language-server' | ||
server_binary_path = os.path.join(server_directory, 'node_modules', 'twiggy-language-server', 'bin', 'server.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"contributions": { | ||
"settings": [ | ||
{ | ||
"file_patterns": [ | ||
"/LSP-twiggy.sublime-settings" | ||
], | ||
"schema": { | ||
"$id": "sublime://settings/LSP-twiggy", | ||
"definitions": { | ||
"PluginConfig": { | ||
"properties": { | ||
"settings": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"twiggy.autoInsertSpaces": { | ||
"type": "boolean", | ||
"default": true, | ||
"markdownDescription": "Insert spaces inside of `{{ | }}` and `{% | %}`." | ||
}, | ||
"twiggy.inlayHints.macroArguments": { | ||
"type": "boolean", | ||
"default": true, | ||
"markdownDescription": "Inlay hints for macro arguments." | ||
}, | ||
"twiggy.inlayHints.macro": { | ||
"type": "boolean", | ||
"default": true, | ||
"markdownDescription": "Inlay hints for `{% endmacro %}`." | ||
}, | ||
"twiggy.inlayHints.block": { | ||
"type": "boolean", | ||
"default": true, | ||
"markdownDescription": "Inlay hints for `{% endblock %}`." | ||
}, | ||
"twiggy.phpExecutable": { | ||
"type": "string", | ||
"scope": "resource", | ||
"default": "php", | ||
"markdownDescription": "Points to the PHP executable." | ||
}, | ||
"twiggy.framework": { | ||
"type": "string", | ||
"scope": "resource", | ||
"enum": [ | ||
"symfony", | ||
"craft", | ||
"ignore" | ||
], | ||
"markdownDescription": "Framework to use." | ||
}, | ||
"twiggy.symfonyConsolePath": { | ||
"type": "string", | ||
"scope": "resource", | ||
"default": "bin/console", | ||
"markdownDescription": "Path to the Symfony console. See: https://symfony.com/doc/current/templates.html#inspecting-twig-information" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "sublime://settings/LSP-plugin-base" | ||
}, | ||
{ | ||
"$ref": "sublime://settings/LSP-twiggy#/definitions/PluginConfig" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"file_patterns": [ | ||
"/*.sublime-project" | ||
], | ||
"schema": { | ||
"properties": { | ||
"settings": { | ||
"properties": { | ||
"LSP": { | ||
"properties": { | ||
"LSP-twiggy": { | ||
"$ref": "sublime://settings/LSP-twiggy#/definitions/PluginConfig" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Tox (http://tox.testrun.org/) is a tool for running tests | ||
# in multiple virtualenvs. This configuration file will run the | ||
# test suite on all supported python versions. To use it, "pip install tox" | ||
# and then run "tox" from this directory. | ||
|
||
[tox] | ||
envlist = py3 | ||
skipsdist = True | ||
|
||
[pycodestyle] | ||
max-line-length = 120 | ||
|
||
[flake8] | ||
max-line-length = 120 | ||
|
||
[testenv] | ||
deps = | ||
flake8==3.7.9 | ||
mypy==0.750 | ||
yapf==0.29.0 | ||
commands = | ||
mypy plugin.py | ||
flake8 plugin.py tests | ||
yapf --diff plugin.py |