def set_options_from_project(self): try: if self._prj is None: return if not isinstance(self._prj, dict): raise ProjectError("project file is not a dictionnary") opts = self._prj.get('options', None) if opts is None: return if not isinstance(opts, dict): raise ProjectError("'options' is not a dictionnary") ghdl_opts = opts.get('ghdl_analysis', None) if ghdl_opts is None: return log.info("Using options: %s", ghdl_opts) for opt in ghdl_opts: if not libghdl.set_option(opt.encode('utf-8')): self._server.show_message(lsp.MessageType.Error, "error with option: {}".format(opt)) except ProjectError as e: self._server.show_message(lsp.MessageType.Error, "error in project file: {}".format(e.msg))
def init(): """Initialization: set options and then load libaries""" libghdl.set_option(b'--std=08') libghdl.analyze_init()