예제 #1
0
# AUTHOR: Yanfei Guo <yanf.guo at gmail.com>
# License: MIT license
# based on original version by BB Chung <afafaf4 at gmail.com>
# ============================================================================

from chromatica.profiler import Profiler

from chromatica import logger
from chromatica import syntax
from chromatica.compile_args_database import CompileArgsDatabase

import chromatica.util as util

current = __file__

util.load_external_module(current, "")
from clang import cindex

import os
import re
import time


class Chromatica(logger.LoggingMixin):
    """Chromatica Core """
    def __init__(self, vim):
        self.__vim = vim
        self.debug_enabled = False
        self.__runtimepath = ""
        self.name = "core"
        self.mark = "[Chromatica Core]"
from chromatica import logger
from chromatica.util import load_external_module

import chromatica.util as util

load_external_module(__file__, "")
from clang import cindex

import os
import re

log = logger.logging.getLogger("chromatica.compile_args")

DEFAULT_STD={"c"   : ["-std=c11"], \
             "cpp" : ["-std=c++14"]}

SOURCE_EXTS = [".c", ".cc", ".cpp", ".cxx"]
compile_args_files = [
    '.color_coded', '.clang', 'compile_flags.txt', '.cquery', '.ccls',
    '.chromatica', 'compile_commands.json'
]


def set_default_std(stds):
    DEFAULT_STD = stds
    return True


class CompileArgsDatabase(object):
    def __init__(self, global_path, global_args=None):
        if global_path:
예제 #3
0
# AUTHOR: Yanfei Guo <yanf.guo at gmail.com>
# License: MIT license
# based on original version by BB Chung <afafaf4 at gmail.com>
# ============================================================================

from chromatica.neovim_helper import NvimHelper
from chromatica.profiler import Profiler

from chromatica import logger
from chromatica import syntax
from chromatica.util import load_external_module
from chromatica.compile_args_database import CompileArgsDatabase

current = __file__

load_external_module(current, "")
from clang import cindex

import os
import re
import time


class Chromatica(logger.LoggingMixin):
    """Chromatica Core """
    def __init__(self, vim):
        self.__vim = vim
        self.vimh = NvimHelper(vim)
        self.__runtimepath = ""
        self.name = "core"
        self.mark = "[Chromatica Core]"
예제 #4
0
from chromatica import logger
from chromatica.util import load_external_module

load_external_module(__file__, "")
from clang import cindex

log = logger.logging.getLogger("chromatica")

def get_cursor(tu, filename, row, col):
    return cindex.Cursor.from_location(tu, \
        cindex.SourceLocation.from_position(tu, tu.get_file(filename), row, col))

def get_symbol(cursor):
    """docstring for get_symbol"""
    if cursor.kind == cindex.CursorKind.MACRO_DEFINITION:
        return cursor

    symbol = cursor.get_definition()
    if not symbol:
        symbol = cursor.referenced

    if not symbol:
        return None

    if symbol.kind == cindex.CursorKind.CONSTRUCTOR \
            or symbol.kind == cindex.CursorKind.DESTRUCTOR:
        symbol = symbol.semantic_parent

    return symbol
예제 #5
0
# AUTHOR: Yanfei Guo <yanf.guo at gmail.com>
# License: MIT license
# based on original version by BB Chung <afafaf4 at gmail.com>
# ============================================================================

from chromatica.neovim_helper import NvimHelper
from chromatica.profiler import Profiler

from chromatica import logger
from chromatica import syntax
from chromatica.util import load_external_module
from chromatica.compile_args_database import CompileArgsDatabase

current = __file__

load_external_module(current, "")
from clang import cindex

import os
import re
import time

class Chromatica(logger.LoggingMixin):

    """Chromatica Core """

    def __init__(self, vim):
        self.__vim = vim
        self.vimh = NvimHelper(vim)
        self.__runtimepath = ""
        self.name = "core"