summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-24 12:02:40 -0500
committerpommicket <pommicket@gmail.com>2022-12-24 12:02:40 -0500
commita6a06900bf7206dc86017bbb1895272ebfac5418 (patch)
tree2f49cee6002d5d10bb4afc0db18425e5f5dfb38e /buffer.c
parent1c346f2aba30fcb581f20f2b67bd5e6adcb4a7e6 (diff)
start LSP setting
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/buffer.c b/buffer.c
index d904c38..831bf89 100644
--- a/buffer.c
+++ b/buffer.c
@@ -307,7 +307,7 @@ static long context_score(const char *path, Language lang, const SettingsContext
}
if (context->path) {
- if (path && str_has_prefix(path, context->path)) {
+ if (path && str_has_path_prefix(path, context->path)) {
score += (long)strlen(context->path);
} else {
// dont use this. it's path-specific and for the wrong path.
@@ -320,18 +320,7 @@ static long context_score(const char *path, Language lang, const SettingsContext
// Get the settings used for this buffer.
Settings *buffer_settings(TextBuffer *buffer) {
- Ted *ted = buffer->ted;
- long best_score = 0;
- Settings *settings = ted->default_settings;
- Language language = buffer_language(buffer);
- arr_foreach_ptr(ted->all_settings, Settings, s) {
- long score = context_score(buffer->filename, language, &s->context);
- if (score > best_score) {
- best_score = score;
- settings = s;
- }
- }
- return settings;
+ return ted_get_settings(buffer->ted, buffer->filename, buffer_language(buffer));
}