mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-10 20:36:21 +00:00
wip
This commit is contained in:
parent
8bfead37b2
commit
0ea2dea1a9
3 changed files with 27 additions and 8 deletions
|
@ -50,18 +50,21 @@ pub enum TagNode {
|
|||
bits: Vec<String>,
|
||||
children: Vec<Node>,
|
||||
},
|
||||
Branching {
|
||||
Branch {
|
||||
name: String,
|
||||
bits: Vec<String>,
|
||||
children: Vec<Node>,
|
||||
branches: Vec<TagNode>,
|
||||
},
|
||||
Closing {
|
||||
name: String,
|
||||
bits: Vec<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct DjangoFilter {
|
||||
name: String,
|
||||
arguments: Vec<String>,
|
||||
pub name: String,
|
||||
pub arguments: Vec<String>,
|
||||
}
|
||||
|
||||
impl DjangoFilter {
|
||||
|
|
|
@ -5,15 +5,21 @@ use std::fs;
|
|||
use std::path::Path;
|
||||
use toml::Value;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct TagSpec {
|
||||
#[serde(rename = "type")]
|
||||
pub tag_type: TagType,
|
||||
pub closing: Option<String>,
|
||||
pub intermediates: Option<Vec<String>>,
|
||||
pub intermediates: Option<Vec<IntermediateSpec>>,
|
||||
pub args: Option<Vec<ArgSpec>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct IntermediateSpec {
|
||||
pub name: String,
|
||||
pub args: bool,
|
||||
}
|
||||
|
||||
impl TagSpec {
|
||||
pub fn load_builtin_specs() -> Result<HashMap<String, TagSpec>> {
|
||||
let specs_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("tagspecs");
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
[django.template.defaulttags.if]
|
||||
type = "block"
|
||||
closing = "endif"
|
||||
intermediates = ["else", "elif"]
|
||||
|
||||
[[django.template.defaulttags.if.intermediates]]
|
||||
name = "elif"
|
||||
args = true
|
||||
|
||||
[[django.template.defaulttags.if.intermediates]]
|
||||
name = "else"
|
||||
args = false
|
||||
|
||||
[[django.template.defaulttags.if.args]]
|
||||
name = "condition"
|
||||
|
@ -10,7 +17,10 @@ required = true
|
|||
[django.template.defaulttags.for]
|
||||
type = "block"
|
||||
closing = "endfor"
|
||||
intermediates = ["empty"]
|
||||
|
||||
[[django.template.defaulttags.for.intermediates]]
|
||||
name = "empty"
|
||||
args = false
|
||||
|
||||
[[django.template.defaulttags.for.args]]
|
||||
name = "{item}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue