Skip to content

Commit

Permalink
temp: Remove clutter from vscode extension
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanRynne committed May 20, 2024
1 parent 3e26a11 commit 7bb1e6a
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 383 deletions.
3 changes: 0 additions & 3 deletions packages/ifc-syntax-vscode/assets/building-black.svg

This file was deleted.

3 changes: 0 additions & 3 deletions packages/ifc-syntax-vscode/assets/building-white.svg

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
{
"comments": {
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "(*", "*)" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"folding": {
"markers": {
"start": "^\\b(TYPE|ENTITY|FUNCTION|RULE|SCHEMA)\\b",
"end": "^\\b(END_TYPE|END_ENTITY|END_FUNCTION|END_RULE|END_SCHEMA)\\b",

},

"comments": {
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": ["(*", "*)"]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"folding": {
"markers": {
"start": "^\\b(TYPE|ENTITY|FUNCTION|RULE|SCHEMA)\\b",
"end": "^\\b(END_TYPE|END_ENTITY|END_FUNCTION|END_RULE|END_SCHEMA)\\b"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
// "lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": ["/*", "*/"]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["/*", "*/"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"folding": {
"markers": {
"start": "^\\b(HEADER|DATA)\\b",
"end": "^\\bENDSEC\\b"
}
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
// "lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": ["/*", "*/"]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["/*", "*/"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"folding": {
"markers": {
"start": "^\\b(HEADER|DATA)\\b",
"end": "^\\bENDSEC\\b"
}
}
}
}
117 changes: 1 addition & 116 deletions packages/ifc-syntax-vscode/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,120 +1,5 @@
import * as path from "path"
import * as vscode from "vscode"
import * as ServerIfc from "@alanrynne/ifc-syntax-server"

import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind
} from "vscode-languageclient/node"

import registerCommands from "./registerCommands"
import { IfcHeadInfoProvider } from "./ifcHeadTreeProvider"

let extensionConfig: vscode.WorkspaceConfiguration = null
let languageClient: LanguageClient = null

export function activate(context: vscode.ExtensionContext) {
console.log("IFC-Syntax has been activated.")

extensionConfig = vscode.workspace.getConfiguration("ifcSyntax")

vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration("ifcSyntax.server.enabled")) {
handleServerEnableChanged(context)
}
})

vscode.window.registerTreeDataProvider("ifcHeader", new IfcHeadInfoProvider())

vscode.window.registerUriHandler({
handleUri(uri: vscode.Uri) {
let query: any = parseQueryString(uri.query)
languageClient.sendRequest("ifc-syntax.docs", query).then(value => {
vscode.commands.executeCommand("ifcSyntax.openDocsViewer", uri, value)
})
}
})

registerCommands(context)

languageClient = setupServer(context)
var serverEnabled = extensionConfig.get("server.enabled")
if (serverEnabled) {
// Start the client. This will also launch the server
languageClient.start()
console.log("Client has started")
}
}

function handleServerEnableChanged(context: vscode.ExtensionContext) {
extensionConfig = vscode.workspace.getConfiguration("ifcSyntax")
var serverEnabled = extensionConfig.get("server.enabled")
if (serverEnabled) {
console.log("Starting server")
if (languageClient === null) {
languageClient = setupServer(context)
}
languageClient.start()
} else {
console.log("Stopping server")
languageClient.stop()
languageClient = null
}
}

export function deactivate(): Thenable<void> {
return languageClient?.stop().then(() => (languageClient = null))
}

function setupServer(context: vscode.ExtensionContext): LanguageClient {
// The server is implemented in node
let serverModule = require.resolve("@alanrynne/ifc-syntax-server")

// The debug options for the server
let debugOptions = {
execArgv: ["--nolazy", "--inspect=6009", "--inspect-brk"]
}

let serverOptions: ServerOptions = {
run: {
module: serverModule,
transport: TransportKind.ipc
},
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions
}
}

// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for ifc text documents
documentSelector: [{ scheme: "file", language: "ifc" }],
synchronize: {
// Notify the server about file changes to '*.ifcconfig' files contained in the workspace
fileEvents: vscode.workspace.createFileSystemWatcher("**/*.ifcconfig")
}
}

// Create the language client and start the client.
var client = new LanguageClient(
"ifcServer",
"IFC Syntax Server",
serverOptions,
clientOptions
)
return client
}

export function parseQueryString(query: string): any {
let pairs = query.split("&")
let queryObj = {}
pairs.forEach(pair => {
let [key, value] = pair.split("=")
queryObj[key] = value
})
return queryObj
console.log("IFC-Syntax has been activated!!!")
}
60 changes: 0 additions & 60 deletions packages/ifc-syntax-vscode/src/ifcHeadTreeProvider.ts

This file was deleted.

Loading

0 comments on commit 7bb1e6a

Please sign in to comment.