Skip to content

Commit 8834ce1

Browse files
authored
Merge pull request #16 from ViTeXFTW/dev/syntax/ViTeXFTW
Fixed formatter error
2 parents 1071976 + 39a22c2 commit 8834ce1

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Node.js
1919
uses: actions/setup-node@v3
2020
with:
21-
node-version: '16.x'
21+
node-version: '20.x'
2222

2323
# Step 3: Install dependencies
2424
- name: Install dependencies
@@ -33,9 +33,9 @@ jobs:
3333
3434
# Step 5: Package and publish the extension
3535
- name: Publish VSCode Extension
36+
uses: lannonbr/[email protected]
37+
with:
38+
args: "publish -p $VSCE_TOKEN"
3639
env:
3740
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
38-
run: |
39-
npx vsce package # This packages the extension
40-
npx vsce publish # This publishes the extension
4141

client/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"engines": {
1818
"vscode": "^1.85.0"
1919
},
20+
"activationEvents": [
21+
"onLanguage:ini"
22+
],
2023
"scripts": {
2124
"compile-test": "tsc -p tsconfig.test.json"
2225
},

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "zerosyntax-server",
33
"displayName": "ZeroSyntax-Server",
44
"description": "Language server for Generals Zero Hour INI files",
5-
"icon": "./images/icon.png",
5+
"icon": "images/icon.png",
66
"version": "0.1.2",
77
"publisher": "ViTeXFTW",
88
"author": {
@@ -29,6 +29,17 @@
2929
],
3030
"main": "./client/out/extension",
3131
"contributes": {
32+
"languages": [
33+
{
34+
"id": "ini",
35+
"aliases": ["Ini", "INI"],
36+
"extensions": [
37+
".ini",
38+
".Ini",
39+
".INI"
40+
]
41+
}
42+
],
3243
"viewsContainers": {
3344
"activitybar": [
3445
{

server/src/server.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ connection.onInitialize((params: InitializeParams) => {
7474
const result: InitializeResult = {
7575
capabilities: {
7676
textDocumentSync: TextDocumentSyncKind.Full,
77+
documentFormattingProvider: true,
7778
// Tell the client that this server supports code completion.
7879
// definitionProvider: false, //true
7980
// hoverProvider: false, //true
@@ -113,16 +114,6 @@ connection.onInitialized(() => {
113114

114115
connection.client.register(DocumentFormattingRequest.type)
115116

116-
connection.onDocumentFormatting((_edits) => {
117-
const document = documents.get(_edits.textDocument.uri)
118-
if (!document) {
119-
console.log(`Document not found.`)
120-
return null
121-
}
122-
123-
return formatDocument(document, _edits.options.tabSize)
124-
})
125-
126117
connection.client.register(DidChangeConfigurationNotification.type)
127118

128119
if (hasConfigurationCapability) {
@@ -140,6 +131,16 @@ connection.onInitialized(() => {
140131
}
141132
});
142133

134+
connection.onDocumentFormatting((_edits) => {
135+
const document = documents.get(_edits.textDocument.uri)
136+
if (!document) {
137+
console.log(`Document not found.`)
138+
return null
139+
}
140+
141+
return formatDocument(document, _edits.options.tabSize)
142+
})
143+
143144
// connection.onDidOpenTextDocument((params: DidOpenTextDocumentParams) => {
144145
// const document = params.textDocument.text
145146
// documents.set(params.textDocument.uri, params.textDocument.text)

0 commit comments

Comments
 (0)