{"id":16669952,"url":"https://github.com/leptos-null/lsphighlight","last_synced_at":"2026-04-16T09:04:13.911Z","repository":{"id":251418093,"uuid":"837348625","full_name":"leptos-null/LspHighlight","owner":"leptos-null","description":"LSP client to output semantic token markup in HTML","archived":false,"fork":false,"pushed_at":"2024-08-19T04:27:29.000Z","size":558,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T17:24:07.404Z","etag":null,"topics":["html-generation","lsp","lsp-client"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leptos-null.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-02T19:00:25.000Z","updated_at":"2025-01-10T15:43:55.000Z","dependencies_parsed_at":"2024-11-18T18:45:56.700Z","dependency_job_id":"1fec555b-dab9-456e-a5e7-1d9212455d1e","html_url":"https://github.com/leptos-null/LspHighlight","commit_stats":null,"previous_names":["leptos-null/lsphighlight"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leptos-null%2FLspHighlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leptos-null%2FLspHighlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leptos-null%2FLspHighlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leptos-null%2FLspHighlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leptos-null","download_url":"https://codeload.github.com/leptos-null/LspHighlight/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243318777,"owners_count":20272136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html-generation","lsp","lsp-client"],"created_at":"2024-10-12T11:36:18.343Z","updated_at":"2025-12-25T09:44:45.239Z","avatar_url":"https://github.com/leptos-null.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"## LspHighlight\n\nLspHighlight is a command line tool designed to act as an LSP client to output a source code file in HTML format with semantic tokens annotated using CSS classes.\n\n\n### Usage\n\n```\nUSAGE: lsp-highlight --lsp-server \u003cpath\u003e [-Xlsp \u003cflag\u003e ...] [--language \u003clanguage\u003e] \u003cfile-path\u003e\n\nARGUMENTS:\n  \u003cfile-path\u003e             Path to the source code file\n\nOPTIONS:\n  -S, --lsp-server \u003cpath\u003e Path to the LSP server\n  -Xlsp \u003cflag\u003e            Pass flag to the LSP server\n  --language \u003clanguage\u003e   The LSP language identifier for the given source code file\n        By default, the program attempts to select the language based on the file name\n  -h, --help              Show help information.\n```\n\n`lsp-highlight` uses \u003chttps://github.com/apple/swift-argument-parser\u003e, which automatically provides shell completion scripts.\nPass `--generate-completion-script` to `lsp-highlight` to generate the completion script for your shell.\n\n```\nuse --generate-completion-script=\u003cshell\u003e with one of:\n    zsh bash fish\n```\n\nFor more information, see https://apple.github.io/swift-argument-parser/documentation/argumentparser/installingcompletionscripts\n\n\n### Sample\n\nThis section demonstrates how `lsp-highlight` may be used.\n\nWe have the code snippet below in a file named `main.m`.\n\n\u003cdetails\u003e\n\n\u003csummary\u003eInput source code\u003c/summary\u003e\n\n(This file is based off of \u003chttps://github.com/leptos-null/iobat/blob/5a2e6719d7ab503612cc0654670bd50c1562fa2e/src/main.m\u003e)\n\n```objc\n//\n//  Created by Leptos on 3/16/19.\n//  Copyright © 2019 Leptos. All rights reserved.\n//\n\n#import \u003cFoundation/Foundation.h\u003e\n#import \u003cIOKit/IOKitLib.h\u003e\n#import \u003cIOKit/pwr_mgt/IOPM.h\u003e\n\n#define TEMPERATURE_EXTREME_STRING \"Warning: Temperature considered to be too \"\n\nint main(int argc, char *argv[]) {\n    BOOL silent = NO;\n    \n    int opt;\n    while ((opt = getopt(argc, argv, \"s\")) != -1) {\n        switch (opt) {\n            case 's':\n                silent = YES;\n                break;\n                \n            default:\n                printf(\"Usage: %s [-s]\\n\"\n                       \"  Battery temperature, as provided by IOKit\\n\"\n                       \"    -s  Silent, print nothing\\n\"\n                       \"\\n\"\n                       \"Exit status is\\n\"\n                       \"  0 if the temperature is within recommended operating temperatures,\\n\"\n                       \"  1 if the temperature is too low,\\n\"\n                       \"  2 if the temperature is too high,\\n\"\n                       \"  3 if the temperature is either too high or low, but which cannot be determined.\\n\"\n                       , argv[0]);\n                return 1;\n        }\n    }\n    \n    mach_port_t mainPort;\n    if (@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)) {\n        mainPort = kIOMainPortDefault;\n    } else {\n        mainPort = kIOMasterPortDefault;\n    }\n    io_service_t service = IOServiceGetMatchingService(mainPort, IOServiceMatching(\"IOPMPowerSource\"));\n    CFNumberRef temperature = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPMPSBatteryTemperatureKey), NULL, 0);\n    CFStringRef chargeStat = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPMPSBatteryChargeStatusKey), NULL, 0);\n    IOObjectRelease(service);\n    \n    double ioTemp = NAN;\n    if (temperature) {\n        CFNumberGetValue(temperature, kCFNumberDoubleType, \u0026ioTemp);\n        CFRelease(temperature);\n    }\n    \n    double const celsiusTemp = ioTemp/100;\n    \n    NSString *chargeStatus = CFBridgingRelease(chargeStat);\n    \n    int ret = 0;\n    const char *warningText = NULL;\n    if ([chargeStatus isEqualToString:@kIOPMBatteryChargeStatusTooHotOrCold]) {\n        warningText = (TEMPERATURE_EXTREME_STRING \"warm or cold\");\n        ret = 3;\n    } else if ([chargeStatus isEqualToString:@kIOPMBatteryChargeStatusTooHot]) {\n        warningText = (TEMPERATURE_EXTREME_STRING \"warm\");\n        ret = 2;\n    } else if ([chargeStatus isEqualToString:@kIOPMBatteryChargeStatusTooCold]) {\n        warningText = (TEMPERATURE_EXTREME_STRING \"cold\");\n        ret = 1;\n    }\n    \n    if (!silent) {\n        NSMeasurement *celsius = [[NSMeasurement alloc] initWithDoubleValue:celsiusTemp unit:NSUnitTemperature.celsius];\n        \n        NSMeasurementFormatter *unitFormatter = [NSMeasurementFormatter new];\n        unitFormatter.unitOptions = NSMeasurementFormatterUnitOptionsNaturalScale;\n        unitFormatter.numberFormatter.maximumFractionDigits = 2;\n        \n        NSString *localizedTemperature = [unitFormatter stringFromMeasurement:celsius];\n        if (warningText) {\n            puts(warningText);\n        }\n        printf(\"Battery temperature: %s\\n\", localizedTemperature.UTF8String);\n    }\n    \n    return ret;\n}\n```\n\n\u003c/details\u003e\n\n\nWe then run `lsp-highlight -S $(xcrun -f clangd) main.m` to produce the following HTML output:\n\n\u003cdetails\u003e\n\n\u003csummary\u003eHTML output\u003c/summary\u003e\n\n```html\n\u003cspan class=\"lsp-type-comment\"\u003e//\u003c/span\u003e\n\u003cspan class=\"lsp-type-comment\"\u003e//  Created by Leptos on 3/16/19.\u003c/span\u003e\n\u003cspan class=\"lsp-type-comment\"\u003e//  Copyright © 2019 Leptos. All rights reserved.\u003c/span\u003e\n\u003cspan class=\"lsp-type-comment\"\u003e//\u003c/span\u003e\n\n\u003cspan class=\"lsp-type-macro\"\u003e#\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eimport\u003c/span\u003e \u003cspan class=\"lsp-type-macro\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eFoundation\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e/\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eFoundation\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e.\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eh\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e\u0026gt;\u003c/span\u003e\n\u003cspan class=\"lsp-type-macro\"\u003e#\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eimport\u003c/span\u003e \u003cspan class=\"lsp-type-macro\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eIOKit\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e/\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eIOKitLib\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e.\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eh\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e\u0026gt;\u003c/span\u003e\n\u003cspan class=\"lsp-type-macro\"\u003e#\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eimport\u003c/span\u003e \u003cspan class=\"lsp-type-macro\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eIOKit\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e/\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003epwr_mgt\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e/\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eIOPM\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e.\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003eh\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003e\u0026gt;\u003c/span\u003e\n\n\u003cspan class=\"lsp-type-macro\"\u003e#\u003c/span\u003e\u003cspan class=\"lsp-type-macro\"\u003edefine\u003c/span\u003e \u003cspan class=\"lsp-type-macro lsp-modifier-declaration lsp-modifier-globalScope\"\u003eTEMPERATURE_EXTREME_STRING\u003c/span\u003e \u003cspan class=\"lsp-type-macro\"\u003e\u0026quot;Warning: Temperature considered to be too \u0026quot;\u003c/span\u003e\n\n\u003cspan class=\"lsp-type-keyword\"\u003eint\u003c/span\u003e \u003cspan class=\"lsp-type-function lsp-modifier-declaration lsp-modifier-globalScope\"\u003emain\u003c/span\u003e(\u003cspan class=\"lsp-type-keyword\"\u003eint\u003c/span\u003e \u003cspan class=\"lsp-type-parameter lsp-modifier-declaration lsp-modifier-functionScope\"\u003eargc\u003c/span\u003e, \u003cspan class=\"lsp-type-keyword\"\u003echar\u003c/span\u003e *\u003cspan class=\"lsp-type-parameter lsp-modifier-functionScope lsp-modifier-declaration\"\u003eargv\u003c/span\u003e[]) {\n    \u003cspan class=\"lsp-type-type lsp-modifier-fileScope lsp-modifier-defaultLibrary\"\u003eBOOL\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-declaration lsp-modifier-functionScope\"\u003esilent\u003c/span\u003e = \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eNO\u003c/span\u003e;\n    \n    \u003cspan class=\"lsp-type-keyword\"\u003eint\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration\"\u003eopt\u003c/span\u003e;\n    \u003cspan class=\"lsp-type-keyword\"\u003ewhile\u003c/span\u003e ((\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eopt\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003egetopt\u003c/span\u003e(\u003cspan class=\"lsp-type-parameter lsp-modifier-functionScope\"\u003eargc\u003c/span\u003e, \u003cspan class=\"lsp-type-parameter lsp-modifier-functionScope\"\u003eargv\u003c/span\u003e, \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;s\u0026quot;\u003c/span\u003e)) \u003cspan class=\"lsp-type-operator\"\u003e!=\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e-\u003c/span\u003e\u003cspan class=\"lsp-type-number\"\u003e1\u003c/span\u003e) {\n        \u003cspan class=\"lsp-type-keyword\"\u003eswitch\u003c/span\u003e (\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eopt\u003c/span\u003e) {\n            \u003cspan class=\"lsp-type-keyword\"\u003ecase\u003c/span\u003e \u003cspan class=\"lsp-type-number\"\u003e\u0026apos;s\u0026apos;\u003c/span\u003e:\n                \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003esilent\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eYES\u003c/span\u003e;\n                \u003cspan class=\"lsp-type-keyword\"\u003ebreak\u003c/span\u003e;\n                \n            \u003cspan class=\"lsp-type-keyword\"\u003edefault\u003c/span\u003e:\n                \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eprintf\u003c/span\u003e(\u003cspan class=\"lsp-type-string\"\u003e\u0026quot;Usage: %s [-s]\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;  Battery temperature, as provided by IOKit\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;    -s  Silent, print nothing\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;Exit status is\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;  0 if the temperature is within recommended operating temperatures,\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;  1 if the temperature is too low,\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;  2 if the temperature is too high,\\n\u0026quot;\u003c/span\u003e\n                       \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;  3 if the temperature is either too high or low, but which cannot be determined.\\n\u0026quot;\u003c/span\u003e\n                       , \u003cspan class=\"lsp-type-parameter lsp-modifier-functionScope\"\u003eargv\u003c/span\u003e[\u003cspan class=\"lsp-type-number\"\u003e0\u003c/span\u003e]);\n                \u003cspan class=\"lsp-type-keyword\"\u003ereturn\u003c/span\u003e \u003cspan class=\"lsp-type-number\"\u003e1\u003c/span\u003e;\n        }\n    }\n    \n    \u003cspan class=\"lsp-type-type lsp-modifier-defaultLibrary lsp-modifier-fileScope\"\u003emach_port_t\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-declaration lsp-modifier-functionScope\"\u003emainPort\u003c/span\u003e;\n    \u003cspan class=\"lsp-type-keyword\"\u003eif\u003c/span\u003e (@\u003cspan class=\"lsp-type-keyword\"\u003eavailable\u003c/span\u003e(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)) {\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003emainPort\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-defaultLibrary lsp-modifier-readonly lsp-modifier-globalScope\"\u003ekIOMainPortDefault\u003c/span\u003e;\n    } \u003cspan class=\"lsp-type-keyword\"\u003eelse\u003c/span\u003e {\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003emainPort\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-readonly lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003ekIOMasterPortDefault\u003c/span\u003e;\n    }\n    \u003cspan class=\"lsp-type-type lsp-modifier-defaultLibrary lsp-modifier-fileScope\"\u003eio_service_t\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration\"\u003eservice\u003c/span\u003e = \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eIOServiceGetMatchingService\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003emainPort\u003c/span\u003e, \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eIOServiceMatching\u003c/span\u003e(\u003cspan class=\"lsp-type-string\"\u003e\u0026quot;IOPMPowerSource\u0026quot;\u003c/span\u003e));\n    \u003cspan class=\"lsp-type-type lsp-modifier-fileScope lsp-modifier-defaultLibrary\"\u003eCFNumberRef\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-readonly lsp-modifier-declaration lsp-modifier-functionScope\"\u003etemperature\u003c/span\u003e = \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eIORegistryEntryCreateCFProperty\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eservice\u003c/span\u003e, \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eCFSTR\u003c/span\u003e(\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003ekIOPMPSBatteryTemperatureKey\u003c/span\u003e), \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eNULL\u003c/span\u003e, \u003cspan class=\"lsp-type-number\"\u003e0\u003c/span\u003e);\n    \u003cspan class=\"lsp-type-type lsp-modifier-defaultLibrary lsp-modifier-fileScope\"\u003eCFStringRef\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-readonly lsp-modifier-declaration\"\u003echargeStat\u003c/span\u003e = \u003cspan class=\"lsp-type-function lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eIORegistryEntryCreateCFProperty\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eservice\u003c/span\u003e, \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eCFSTR\u003c/span\u003e(\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003ekIOPMPSBatteryChargeStatusKey\u003c/span\u003e), \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eNULL\u003c/span\u003e, \u003cspan class=\"lsp-type-number\"\u003e0\u003c/span\u003e);\n    \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eIOObjectRelease\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eservice\u003c/span\u003e);\n    \n    \u003cspan class=\"lsp-type-keyword\"\u003edouble\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration\"\u003eioTemp\u003c/span\u003e = \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eNAN\u003c/span\u003e;\n    \u003cspan class=\"lsp-type-keyword\"\u003eif\u003c/span\u003e (\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-readonly\"\u003etemperature\u003c/span\u003e) {\n        \u003cspan class=\"lsp-type-function lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eCFNumberGetValue\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-readonly\"\u003etemperature\u003c/span\u003e, \u003cspan class=\"lsp-type-enumMember lsp-modifier-readonly lsp-modifier-fileScope lsp-modifier-defaultLibrary\"\u003ekCFNumberDoubleType\u003c/span\u003e, \u003cspan class=\"lsp-type-operator\"\u003e\u0026amp;\u003c/span\u003e\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eioTemp\u003c/span\u003e);\n        \u003cspan class=\"lsp-type-function lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eCFRelease\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-readonly lsp-modifier-functionScope\"\u003etemperature\u003c/span\u003e);\n    }\n    \n    \u003cspan class=\"lsp-type-keyword\"\u003edouble\u003c/span\u003e \u003cspan class=\"lsp-type-keyword\"\u003econst\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration lsp-modifier-readonly\"\u003ecelsiusTemp\u003c/span\u003e = \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eioTemp\u003c/span\u003e\u003cspan class=\"lsp-type-operator\"\u003e/\u003c/span\u003e\u003cspan class=\"lsp-type-number\"\u003e100\u003c/span\u003e;\n    \n    \u003cspan class=\"lsp-type-class lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eNSString\u003c/span\u003e *\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration\"\u003echargeStatus\u003c/span\u003e = \u003cspan class=\"lsp-type-function lsp-modifier-fileScope lsp-modifier-defaultLibrary\"\u003eCFBridgingRelease\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-readonly lsp-modifier-functionScope\"\u003echargeStat\u003c/span\u003e);\n    \n    \u003cspan class=\"lsp-type-keyword\"\u003eint\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration\"\u003eret\u003c/span\u003e = \u003cspan class=\"lsp-type-number\"\u003e0\u003c/span\u003e;\n    \u003cspan class=\"lsp-type-keyword\"\u003econst\u003c/span\u003e \u003cspan class=\"lsp-type-keyword\"\u003echar\u003c/span\u003e *\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration lsp-modifier-readonly\"\u003ewarningText\u003c/span\u003e = \u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eNULL\u003c/span\u003e;\n    \u003cspan class=\"lsp-type-keyword\"\u003eif\u003c/span\u003e ([\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003echargeStatus\u003c/span\u003e \u003cspan class=\"lsp-type-method lsp-modifier-defaultLibrary lsp-modifier-classScope\"\u003eisEqualToString\u003c/span\u003e:\u003cspan class=\"lsp-type-string\"\u003e@\u003c/span\u003e\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003ekIOPMBatteryChargeStatusTooHotOrCold\u003c/span\u003e]) {\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-readonly\"\u003ewarningText\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e (\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eTEMPERATURE_EXTREME_STRING\u003c/span\u003e \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;warm or cold\u0026quot;\u003c/span\u003e);\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eret\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-number\"\u003e3\u003c/span\u003e;\n    } \u003cspan class=\"lsp-type-keyword\"\u003eelse\u003c/span\u003e \u003cspan class=\"lsp-type-keyword\"\u003eif\u003c/span\u003e ([\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003echargeStatus\u003c/span\u003e \u003cspan class=\"lsp-type-method lsp-modifier-defaultLibrary lsp-modifier-classScope\"\u003eisEqualToString\u003c/span\u003e:\u003cspan class=\"lsp-type-string\"\u003e@\u003c/span\u003e\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003ekIOPMBatteryChargeStatusTooHot\u003c/span\u003e]) {\n        \u003cspan class=\"lsp-type-variable lsp-modifier-readonly lsp-modifier-functionScope\"\u003ewarningText\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e (\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eTEMPERATURE_EXTREME_STRING\u003c/span\u003e \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;warm\u0026quot;\u003c/span\u003e);\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eret\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-number\"\u003e2\u003c/span\u003e;\n    } \u003cspan class=\"lsp-type-keyword\"\u003eelse\u003c/span\u003e \u003cspan class=\"lsp-type-keyword\"\u003eif\u003c/span\u003e ([\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003echargeStatus\u003c/span\u003e \u003cspan class=\"lsp-type-method lsp-modifier-classScope lsp-modifier-defaultLibrary\"\u003eisEqualToString\u003c/span\u003e:\u003cspan class=\"lsp-type-string\"\u003e@\u003c/span\u003e\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003ekIOPMBatteryChargeStatusTooCold\u003c/span\u003e]) {\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-readonly\"\u003ewarningText\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e (\u003cspan class=\"lsp-type-macro lsp-modifier-globalScope\"\u003eTEMPERATURE_EXTREME_STRING\u003c/span\u003e \u003cspan class=\"lsp-type-string\"\u003e\u0026quot;cold\u0026quot;\u003c/span\u003e);\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eret\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-number\"\u003e1\u003c/span\u003e;\n    }\n    \n    \u003cspan class=\"lsp-type-keyword\"\u003eif\u003c/span\u003e (\u003cspan class=\"lsp-type-operator\"\u003e!\u003c/span\u003e\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003esilent\u003c/span\u003e) {\n        \u003cspan class=\"lsp-type-class lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eNSMeasurement\u003c/span\u003e *\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration\"\u003ecelsius\u003c/span\u003e = [[\u003cspan class=\"lsp-type-class lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eNSMeasurement\u003c/span\u003e \u003cspan class=\"lsp-type-function lsp-modifier-static lsp-modifier-classScope lsp-modifier-defaultLibrary\"\u003ealloc\u003c/span\u003e] \u003cspan class=\"lsp-type-method lsp-modifier-classScope lsp-modifier-defaultLibrary\"\u003einitWithDoubleValue\u003c/span\u003e:\u003cspan class=\"lsp-type-variable lsp-modifier-readonly lsp-modifier-functionScope\"\u003ecelsiusTemp\u003c/span\u003e \u003cspan class=\"lsp-type-method lsp-modifier-defaultLibrary lsp-modifier-classScope\"\u003eunit\u003c/span\u003e:\u003cspan class=\"lsp-type-class lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eNSUnitTemperature\u003c/span\u003e.\u003cspan class=\"lsp-type-property lsp-modifier-defaultLibrary lsp-modifier-static lsp-modifier-classScope\"\u003ecelsius\u003c/span\u003e];\n        \n        \u003cspan class=\"lsp-type-class lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eNSMeasurementFormatter\u003c/span\u003e *\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-declaration\"\u003eunitFormatter\u003c/span\u003e = [\u003cspan class=\"lsp-type-class lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eNSMeasurementFormatter\u003c/span\u003e \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-classScope lsp-modifier-static\"\u003enew\u003c/span\u003e];\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eunitFormatter\u003c/span\u003e.\u003cspan class=\"lsp-type-property lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eunitOptions\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-enumMember lsp-modifier-defaultLibrary lsp-modifier-fileScope lsp-modifier-readonly\"\u003eNSMeasurementFormatterUnitOptionsNaturalScale\u003c/span\u003e;\n        \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eunitFormatter\u003c/span\u003e.\u003cspan class=\"lsp-type-property lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003enumberFormatter\u003c/span\u003e.\u003cspan class=\"lsp-type-property lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003emaximumFractionDigits\u003c/span\u003e \u003cspan class=\"lsp-type-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"lsp-type-number\"\u003e2\u003c/span\u003e;\n        \n        \u003cspan class=\"lsp-type-class lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eNSString\u003c/span\u003e *\u003cspan class=\"lsp-type-variable lsp-modifier-declaration lsp-modifier-functionScope\"\u003elocalizedTemperature\u003c/span\u003e = [\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eunitFormatter\u003c/span\u003e \u003cspan class=\"lsp-type-method lsp-modifier-classScope lsp-modifier-defaultLibrary\"\u003estringFromMeasurement\u003c/span\u003e:\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003ecelsius\u003c/span\u003e];\n        \u003cspan class=\"lsp-type-keyword\"\u003eif\u003c/span\u003e (\u003cspan class=\"lsp-type-variable lsp-modifier-functionScope lsp-modifier-readonly\"\u003ewarningText\u003c/span\u003e) {\n            \u003cspan class=\"lsp-type-function lsp-modifier-globalScope lsp-modifier-defaultLibrary\"\u003eputs\u003c/span\u003e(\u003cspan class=\"lsp-type-variable lsp-modifier-readonly lsp-modifier-functionScope\"\u003ewarningText\u003c/span\u003e);\n        }\n        \u003cspan class=\"lsp-type-function lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eprintf\u003c/span\u003e(\u003cspan class=\"lsp-type-string\"\u003e\u0026quot;Battery temperature: %s\\n\u0026quot;\u003c/span\u003e, \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003elocalizedTemperature\u003c/span\u003e.\u003cspan class=\"lsp-type-property lsp-modifier-readonly lsp-modifier-defaultLibrary lsp-modifier-globalScope\"\u003eUTF8String\u003c/span\u003e);\n    }\n    \n    \u003cspan class=\"lsp-type-keyword\"\u003ereturn\u003c/span\u003e \u003cspan class=\"lsp-type-variable lsp-modifier-functionScope\"\u003eret\u003c/span\u003e;\n}\n```\n\n\u003c/details\u003e\n\n\nWe can then place the snippet above into a full HTML document.\nWith some CSS, this is what the result may look like:\n\n![Code snippet with syntax highlighting](Screenshots/iobat_main-dark.png)\n\n## XcodeLspStyle\n\nThis project also includes a tool to generate CSS from a `.xccolortheme` (Xcode theme) file.\n\nThis CSS applies styles to the same classes output from `lsp-highlight`.\n\n### Usage\n\n```\nUSAGE: xcode-lsp-style \u003cxccolortheme\u003e\n\nARGUMENTS:\n  \u003cxccolortheme\u003e          Path to the xccolortheme\n        These can generally be found with `find $(xcode-select -p)/.. ~/Library/Developer/Xcode/UserData -name '*.xccolortheme' -type f`\n\nOPTIONS:\n  -h, --help              Show help information.\n```\n\n### Sample\n\n`xcode-lsp-style \"/Applications/Xcode.app/Contents/SharedFrameworks/DVTUserInterfaceKit.framework/Versions/A/Resources/FontAndColorThemes/High Contrast (Dark).xccolortheme\"`\n\n\u003cdetails\u003e\n\n\u003csummary\u003eCSS output\u003c/summary\u003e\n\n```css\n.lsp-type-modifier {\n    color: #e1a778;\n}\n.lsp-type-comment {\n    color: #7cb454;\n}\n.lsp-type-keyword {\n    color: #fc6ba9;\n}\n.lsp-type-number {\n    color: #cfbb55;\n}\n.lsp-type-string {\n    color: #fc7367;\n}\n.lsp-type-class {\n    color: #a4fae5;\n}\n.lsp-type-class.lsp-modifier-defaultLibrary {\n    color: #ddc1fe;\n}\n.lsp-type-enumMember {\n    color: #72bead;\n}\n.lsp-type-enumMember.lsp-modifier-defaultLibrary {\n    color: #c089fe;\n}\n.lsp-type-function,\n.lsp-type-method,\n.lsp-type-property {\n    color: #72bead;\n}\n.lsp-type-function.lsp-modifier-defaultLibrary,\n.lsp-type-method.lsp-modifier-defaultLibrary,\n.lsp-type-property.lsp-modifier-defaultLibrary {\n    color: #c089fe;\n}\n.lsp-type-macro {\n    color: #fc8e3e;\n}\n.lsp-type-macro.lsp-modifier-defaultLibrary {\n    color: #fc8e3e;\n}\n.lsp-type-type {\n    color: #a4fae5;\n}\n.lsp-type-type.lsp-modifier-defaultLibrary {\n    color: #ddc1fe;\n}\n.lsp-type-variable.lsp-modifier-globalScope {\n    color: #72bead;\n}\n.lsp-type-variable.lsp-modifier-globalScope.lsp-modifier-defaultLibrary {\n    color: #c089fe;\n}\n```\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleptos-null%2Flsphighlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleptos-null%2Flsphighlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleptos-null%2Flsphighlight/lists"}