Commit d1090f75 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Autocompletion dict update on text area

parent d1bfcf98
......@@ -687,11 +687,6 @@ class TextArea(object):
''' Text area (raw content for rendering only) '''
self.inputString = '-- Declare your variables\n\n' \
'-- Syntax: DCL <variable name> <type name>;\n\n'
# DCL variables in the text area {name: (sort, default_value), ...}
self.variables = {}
# fpar and timers are also listed, useful when using autocompletion
self.fpar = []
self.timers = []
self.line = None
self.charPositionInLine = None
# Set default coordinates and width/height
......@@ -699,6 +694,13 @@ class TextArea(object):
self.pos_y = 0
self.width = 170
self.height = 140
# DCL variables in the text area {name: (sort, default_value), ...}
self.variables = {}
# fpar and timers are also listed, useful when using autocompletion
self.fpar = []
self.timers = []
# inner procedures - useful to get autocompletion params
self.procedures = []
# optional hyperlink
self.hyperlink = None
......
......@@ -2257,6 +2257,8 @@ def text_area_content(root, ta_ast, context):
context.content.inner_procedures.append(proc)
# Add to context to make it visible at scope level
context.procedures.append(proc)
# And add it to the TextArea AST for the text autocompletion
ta_ast.procedures.append(proc)
elif child.type == lexer.FPAR:
params, err, warn = fpar(child)
errors.extend(err)
......
......@@ -49,7 +49,7 @@ SDL_BLACKBOLD = ['\\b{word}\\b'.format(word=word) for word in (
'LENGTH', 'PRESENT', 'FPAR', 'TODO', 'FIXME', 'XXX',
'CHECKME', 'PROCEDURE', 'EXTERNAL', 'IN', 'OUT', 'TIMER',
'SET_TIMER', 'RESET_TIMER', 'VIA', 'ENTRY', 'EXIT',
'SYNTYPE', 'ENDSYNTYPE', 'CONSTANTS',
'SYNTYPE', 'ENDSYNTYPE', 'CONSTANTS', 'ENDPROCEDURE',
'NEWTYPE', 'ENDNEWTYPE', 'ARRAY', 'STRUCT', 'SYNONYM')]
SDL_REDBOLD = ['\\b{word}\\b'.format(word=word) for word in (
......@@ -745,6 +745,7 @@ class TextSymbol(HorizontalSymbol):
ast, _, _, _, _ = self.parser.parseSingleElement('text_area', pr_text)
CONTEXT.variables.update(ast.variables)
CONTEXT.timers = list(set(CONTEXT.timers + ast.timers))
CONTEXT.procedures = list(set(CONTEXT.procedures + ast.procedures))
try:
CONTEXT.fpar.extend(ast.fpar)
except AttributeError:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment