def __init__(self): editor.callbackSync(self.on_updateui, [SCINTILLANOTIFICATION.UPDATEUI]) notepad.callback(self.on_langchanged, [NOTIFICATION.LANGCHANGED]) notepad.callback(self.on_bufferactivated, [NOTIFICATION.BUFFERACTIVATED]) self.__is_lexer_doc = False self.get_lexer_name = lambda: notepad.getLanguageName( notepad.getLangType())
def check_lexer(self): ''' Checks if the current document is of interest and sets the flag accordingly Args: None Returns: None ''' self.document_is_of_interest = notepad.getLanguageName( notepad.getLangType()) == 'Intel HEX' if self.debug_mode: print('document is of interest:{}'.format( self.document_is_of_interest))
def check_lexers(self): ''' Checks if the current document of each view is of interest and sets the flag accordingly Args: None Returns: None ''' current_language = notepad.getLanguageName( notepad.getLangType()).replace('udf - ', '').lower() self.document_is_of_interest = current_language in self.registered_lexers if self.document_is_of_interest: self.regexes, self.excluded_styles = self.registered_lexers[ current_language]
def on_buffer_activated(self, args): log(f'{args}') self.current_language = notepad.getLanguageName( notepad.getLangType()).upper() if args['bufferID'] not in self.open_files_dict: self.current_file = notepad.getCurrentFilename() self.open_files_dict[args['bufferID']] = self.current_file else: self.current_file = self.open_files_dict[args['bufferID']] # temporary files are not supported if self.current_file.rpartition('\\')[0] == '': log('temporary files are not supported (yet?)') self.lsp_doc_flag = False return if self.current_language in self.available_lsp_servers: self.lsp_doc_flag = True if not self.com_manager.already_initialized(self.current_language): self.current_triggers[self.current_language] = { 'signatureHelpProvider': [], 'completionProvider': [] } self.com_manager.send( self.lsp_msg.initialize( self.current_file.rpartition('\\')[0], os.getpid())) self.com_manager.waiting_for_initialize_result = True _version = self._get_file_version() if _version == 0: log(f'file {self.current_file} first seen') self.com_manager.send( self.lsp_msg.didOpen(self.current_file, self.current_language.lower(), _version, editor.getText())) self.sent_didopen_files.append(args['bufferID']) else: log(f'{self.current_language} not in {self.available_lsp_servers}') self.lsp_doc_flag = False
def __init__(self): self.__is_lexer_doc = False self.get_lexer_name = lambda: notepad.getLanguageName(notepad. getLangType()) self.indicator = 0
def __init__(self): editor.callbackSync(self.on_updateui, [SCINTILLANOTIFICATION.UPDATEUI]) notepad.callback(self.on_langchanged, [NOTIFICATION.LANGCHANGED]) notepad.callback(self.on_bufferactivated, [NOTIFICATION.BUFFERACTIVATED]) self.__is_lexer_doc = False self.get_lexer_name = lambda: notepad.getLanguageName(notepad.getLangType())