RLovelett / langserver-swift

A Swift implementation of the open Language Server Protocol.
Apache License 2.0
177 stars 16 forks source link

Crude XML Tag removal... #10

Closed oderwat closed 6 years ago

oderwat commented 7 years ago

Popup on all elements seem to work fine for me now!

Maybe just remove the XML Tags from the result by adding a simple filter which translates those tags into either "nothing", "a space" or "a newline". With using "a space" for all unknown tags.

If it is possible to output your own HTML in the popup you could also translate the XML tag into a prefixed css class and all of the tags into div (or span) elements. So one could adjust the output with CSS easily and adding newly encountered tag types would be fairly easy.

chrismwendt commented 6 years ago

@RLovelett I'm working on this right now. My approach is to use https://github.com/tadija/AEXML to extract all the text out of the XML.

I'm totally new to Swift and Xcode and I ran into an import error (for import AEXML) when I build the project in Xcode, but it compiles fine with make debug. Any tips?

@@ Package.swift

         .package(url: "https://github.com/RLovelett/swift-package-manager.git", .branch("swift-4.1-branch")),
+        .package(url: "https://github.com/tadija/AEXML.git", .branch("master"))
     ],
...
        .target(
            name: "LanguageServerProtocol",
            dependencies: [
                "BaseProtocol",
                "SourceKitter",
                 "SwiftPM",
+                "AEXML",
             ]

@@ Sources/LanguageServerProtocol/Types/Server.swift:

 import class Workspace.Workspace
+import AEXML // Xcode says "No such module 'AEXML'"
vknabel commented 6 years ago

@chrismwendt did you already run make xcodeproj?

chrismwendt commented 6 years ago

@vknabel Thanks, that did the trick!

chrismwendt commented 6 years ago

Aww yiss! https://github.com/RLovelett/langserver-swift/pull/48

swift-hovers

RLovelett commented 6 years ago

Fixed in 24b35d70bcf627fb17cf45fc270ea7e29ed51e41