Skip to content

Commit

Permalink
Merge pull request #16 from ViTeXFTW/dev/syntax/ViTeXFTW
Browse files Browse the repository at this point in the history
Fixed formatter error
  • Loading branch information
ViTeXFTW authored Oct 24, 2024
2 parents 1071976 + 39a22c2 commit 8834ce1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '20.x'

# Step 3: Install dependencies
- name: Install dependencies
Expand All @@ -33,9 +33,9 @@ jobs:
# Step 5: Package and publish the extension
- name: Publish VSCode Extension
uses: lannonbr/[email protected]
with:
args: "publish -p $VSCE_TOKEN"
env:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
run: |
npx vsce package # This packages the extension
npx vsce publish # This publishes the extension

3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"engines": {
"vscode": "^1.85.0"
},
"activationEvents": [
"onLanguage:ini"
],
"scripts": {
"compile-test": "tsc -p tsconfig.test.json"
},
Expand Down
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "zerosyntax-server",
"displayName": "ZeroSyntax-Server",
"description": "Language server for Generals Zero Hour INI files",
"icon": "./images/icon.png",
"icon": "images/icon.png",
"version": "0.1.2",
"publisher": "ViTeXFTW",
"author": {
Expand All @@ -29,6 +29,17 @@
],
"main": "./client/out/extension",
"contributes": {
"languages": [
{
"id": "ini",
"aliases": ["Ini", "INI"],
"extensions": [
".ini",
".Ini",
".INI"
]
}
],
"viewsContainers": {
"activitybar": [
{
Expand Down
21 changes: 11 additions & 10 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ connection.onInitialize((params: InitializeParams) => {
const result: InitializeResult = {
capabilities: {
textDocumentSync: TextDocumentSyncKind.Full,
documentFormattingProvider: true,
// Tell the client that this server supports code completion.
// definitionProvider: false, //true
// hoverProvider: false, //true
Expand Down Expand Up @@ -113,16 +114,6 @@ connection.onInitialized(() => {

connection.client.register(DocumentFormattingRequest.type)

connection.onDocumentFormatting((_edits) => {
const document = documents.get(_edits.textDocument.uri)
if (!document) {
console.log(`Document not found.`)
return null
}

return formatDocument(document, _edits.options.tabSize)
})

connection.client.register(DidChangeConfigurationNotification.type)

if (hasConfigurationCapability) {
Expand All @@ -140,6 +131,16 @@ connection.onInitialized(() => {
}
});

connection.onDocumentFormatting((_edits) => {
const document = documents.get(_edits.textDocument.uri)
if (!document) {
console.log(`Document not found.`)
return null
}

return formatDocument(document, _edits.options.tabSize)
})

// connection.onDidOpenTextDocument((params: DidOpenTextDocumentParams) => {
// const document = params.textDocument.text
// documents.set(params.textDocument.uri, params.textDocument.text)
Expand Down

0 comments on commit 8834ce1

Please sign in to comment.