forked from enlightenment/edi
syntax: reset status and hints when we reset token
re-use elm_code methods when we do this in edi
This commit is contained in:
parent
d03675ba71
commit
bc6ec2dd6f
|
@ -28,6 +28,17 @@ EAPI void elm_code_line_status_set(Elm_Code_Line *line, Elm_Code_Status_Type sta
|
||||||
line->status = status;
|
line->status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void elm_code_line_status_text_set(Elm_Code_Line *line, const char *text)
|
||||||
|
{
|
||||||
|
if (line->status_text)
|
||||||
|
free(line->status_text);
|
||||||
|
|
||||||
|
if (text)
|
||||||
|
line->status_text = strdup(text);
|
||||||
|
else
|
||||||
|
line->status_text = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void elm_code_line_token_add(Elm_Code_Line *line, int start, int end, int lines,
|
EAPI void elm_code_line_token_add(Elm_Code_Line *line, int start, int end, int lines,
|
||||||
Elm_Code_Token_Type type)
|
Elm_Code_Token_Type type)
|
||||||
{
|
{
|
||||||
|
@ -67,3 +78,13 @@ EAPI void elm_code_line_tokens_clear(Elm_Code_Line *line)
|
||||||
line->tokens = NULL;
|
line->tokens = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void elm_code_line_status_clear(Elm_Code_Line *line)
|
||||||
|
{
|
||||||
|
line->status = ELM_CODE_STATUS_TYPE_DEFAULT;
|
||||||
|
if (line->status_text)
|
||||||
|
{
|
||||||
|
free((char *)line->status_text);
|
||||||
|
line->status_text = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ typedef struct _Elm_Code_Line
|
||||||
Eina_List *tokens;
|
Eina_List *tokens;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
const char *status_text;
|
char *status_text;
|
||||||
} Elm_Code_Line;
|
} Elm_Code_Line;
|
||||||
|
|
||||||
EAPI void elm_code_line_free(Elm_Code_Line *line);
|
EAPI void elm_code_line_free(Elm_Code_Line *line);
|
||||||
|
@ -49,6 +49,10 @@ EAPI void elm_code_line_free(Elm_Code_Line *line);
|
||||||
|
|
||||||
EAPI void elm_code_line_status_set(Elm_Code_Line *line, Elm_Code_Status_Type status);
|
EAPI void elm_code_line_status_set(Elm_Code_Line *line, Elm_Code_Status_Type status);
|
||||||
|
|
||||||
|
EAPI void elm_code_line_status_text_set(Elm_Code_Line *line, const char *text);
|
||||||
|
|
||||||
|
EAPI void elm_code_line_status_clear(Elm_Code_Line *line);
|
||||||
|
|
||||||
EAPI void elm_code_line_token_add(Elm_Code_Line *line, int start, int end, int lines, Elm_Code_Token_Type type);
|
EAPI void elm_code_line_token_add(Elm_Code_Line *line, int start, int end, int lines, Elm_Code_Token_Type type);
|
||||||
|
|
||||||
EAPI void elm_code_line_tokens_clear(Elm_Code_Line *line);
|
EAPI void elm_code_line_tokens_clear(Elm_Code_Line *line);
|
||||||
|
|
|
@ -23,6 +23,7 @@ _elm_code_parse_line(Elm_Code *code, Elm_Code_Line *line)
|
||||||
Eina_List *item;
|
Eina_List *item;
|
||||||
|
|
||||||
elm_code_line_tokens_clear(line);
|
elm_code_line_tokens_clear(line);
|
||||||
|
elm_code_line_status_clear(line);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(code->parsers, item, parser)
|
EINA_LIST_FOREACH(code->parsers, item, parser)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,7 @@ _elm_code_parse_file(Elm_Code *code, Elm_Code_File *file)
|
||||||
EINA_LIST_FOREACH(file->lines, item, line)
|
EINA_LIST_FOREACH(file->lines, item, line)
|
||||||
{
|
{
|
||||||
elm_code_line_tokens_clear(line);
|
elm_code_line_tokens_clear(line);
|
||||||
|
elm_code_line_status_clear(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(code->parsers, item, parser)
|
EINA_LIST_FOREACH(code->parsers, item, parser)
|
||||||
|
|
|
@ -301,7 +301,7 @@ _edi_line_status_set(Edi_Editor *editor, unsigned int number, Elm_Code_Status_Ty
|
||||||
|
|
||||||
elm_code_line_status_set(line, status);
|
elm_code_line_status_set(line, status);
|
||||||
if (text)
|
if (text)
|
||||||
line->status_text = strdup(text);
|
elm_code_line_status_text_set(line, text);
|
||||||
|
|
||||||
eo_do(editor->entry,
|
eo_do(editor->entry,
|
||||||
elm_code_widget_line_refresh(line));
|
elm_code_widget_line_refresh(line));
|
||||||
|
@ -446,8 +446,6 @@ _clang_load_errors(const char *path EINA_UNUSED, Edi_Editor *editor)
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
|
||||||
eo_do(editor->entry, code = elm_code_widget_code_get());
|
eo_do(editor->entry, code = elm_code_widget_code_get());
|
||||||
for (i = 1; i <= elm_code_file_lines_get(code->file); i++)
|
|
||||||
_edi_line_status_set(editor, i, ELM_CODE_STATUS_TYPE_DEFAULT, NULL);
|
|
||||||
|
|
||||||
for(i = 0, n = clang_getNumDiagnostics(editor->tx_unit); i != n; ++i)
|
for(i = 0, n = clang_getNumDiagnostics(editor->tx_unit); i != n; ++i)
|
||||||
{
|
{
|
||||||
|
@ -533,9 +531,21 @@ _edi_clang_dispose(Edi_Editor *editor)
|
||||||
static void
|
static void
|
||||||
_reset_highlight(Edi_Editor *editor)
|
_reset_highlight(Edi_Editor *editor)
|
||||||
{
|
{
|
||||||
|
Eina_List *item;
|
||||||
|
Elm_Code *code;
|
||||||
|
Elm_Code_Line *line;
|
||||||
|
|
||||||
if (!editor->show_highlight)
|
if (!editor->show_highlight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
eo_do(editor->entry,
|
||||||
|
code = elm_code_widget_code_get());
|
||||||
|
EINA_LIST_FOREACH(code->file->lines, item, line)
|
||||||
|
{
|
||||||
|
elm_code_line_tokens_clear(line);
|
||||||
|
elm_code_line_status_clear(line);
|
||||||
|
}
|
||||||
|
|
||||||
#if HAVE_LIBCLANG
|
#if HAVE_LIBCLANG
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_t thread_id;
|
pthread_t thread_id;
|
||||||
|
|
Loading…
Reference in New Issue