1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-04 03:50:05 +08:00
SpaceVim/bundle/defx.nvim/rplugin/python3/defx/base/column.py

65 lines
1.8 KiB
Python
Raw Normal View History

2020-06-13 14:06:35 +08:00
# ============================================================================
# FILE: column.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
import typing
from abc import abstractmethod
from defx.context import Context
2020-10-31 15:58:52 +08:00
from defx.util import Nvim, Candidate
2020-06-13 14:06:35 +08:00
from defx.util import error
from defx.view import View
2020-10-31 15:58:52 +08:00
Highlights = typing.List[typing.Tuple[str, int, int]]
2020-06-13 14:06:35 +08:00
class Base:
def __init__(self, vim: Nvim) -> None:
self.vim: Nvim = vim
self.name: str = 'base'
self.syntax_name: str = ''
2020-10-31 15:58:52 +08:00
self.highlight_name: str = ''
2020-06-13 14:06:35 +08:00
self.start: int = -1
self.end: int = -1
self.vars: typing.Dict[str, typing.Any] = {}
self.is_start_variable: bool = False
self.is_stop_variable: bool = False
self.is_within_variable: bool = False
2020-10-31 15:58:52 +08:00
self.has_get_with_highlights: bool = False
2020-06-13 14:06:35 +08:00
def on_init(self, view: View, context: Context) -> None:
pass
def on_redraw(self, view: View, context: Context) -> None:
pass
2020-10-31 15:58:52 +08:00
def get(self, context: Context, candidate: Candidate) -> str:
2020-06-13 14:06:35 +08:00
return ''
def get_with_variable_text(
2020-10-31 15:58:52 +08:00
self, context: Context, variable_text: str, candidate: Candidate
) -> typing.Tuple[str, Highlights]:
return ('', [])
def get_with_highlights(
self, context: Context, candidate: Candidate
) -> typing.Tuple[str, Highlights]:
return ('', [])
2020-06-13 14:06:35 +08:00
@abstractmethod
def length(self, context: Context) -> int:
pass
def syntaxes(self) -> typing.List[str]:
return []
def highlight_commands(self) -> typing.List[str]:
return []
def debug(self, expr: typing.Any) -> None:
error(self.vim, expr)