-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
temp: Remove clutter from vscode extension
- Loading branch information
Showing
7 changed files
with
68 additions
and
383 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
66 changes: 32 additions & 34 deletions
66
packages/ifc-syntax-vscode/languages/express-language-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} | ||
} |
70 changes: 35 additions & 35 deletions
70
packages/ifc-syntax-vscode/languages/ifc-language-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!!!") | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.