Revert "core syntax: strip the path from filename on syntax.get (#1168)" (#1322)

* Revert "core syntax: strip the path from filename on syntax.get (#1168)"

This reverts commit af6c4bc152.

The previous behavior was correct and allowed access to the full path for path-dependant syntaxes.

* Use `Doc.abs_filename` to obtain syntax when possible

This allows matching full paths in language syntaxes, but we lose the
possibility of matching the project root.
This commit is contained in:
Guldoman
2023-08-19 13:28:14 +08:00
committed by takase1121
parent ff884d7d4a
commit 68e9c4670e
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ local function find(string, field)
end
function syntax.get(filename, header)
return find(common.basename(filename), "files")
return find(filename, "files")
or (header and find(header, "headers"))
or plain_text_syntax
end