Open Freed-Wu opened 1 year ago
Why not use iStyle to provide format function like:
https://github.com/regen100/cmake-language-server/blob/master/cmake_language_server/server.py#L156-L179:
if shutil.which("cmake-format") is not None: @self.feature(TEXT_DOCUMENT_FORMATTING) def formatting( params: DocumentFormattingParams, ) -> Optional[List[TextEdit]]: doc = self.workspace.get_document(params.text_document.uri) content = doc.source formatted = subprocess.check_output( ["cmake-format", "-"], cwd=str(Path(doc.path).parent), input=content, universal_newlines=True, ) lines = content.count("\n") return [ TextEdit( range=Range( start=Position(line=0, character=0), end=Position(line=lines + 1, character=0), ), new_text=formatted, ) ]
Why not use iStyle to provide format function like:
https://github.com/regen100/cmake-language-server/blob/master/cmake_language_server/server.py#L156-L179: