Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tangzx committed Aug 26, 2018
2 parents e196c3d + 8c01eed commit 37f5088
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EmmyLua for VSCode
# EmmyLua for VSCode (Unstable)

[![Online EmmyLua Doc](https://img.shields.io/badge/emmy-doc-46BC99.svg?style=flat-square)](https://emmylua.github.io)
[![donate](https://img.shields.io/badge/donate-emmy-FF69B4.svg?style=flat-square)](https://emmylua.github.io/donate.html)
Expand All @@ -16,4 +16,4 @@

### 1.0.0

Initial release of ...
Initial release of ...
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,17 @@
"test": "npm run compile && node ./node_modules/vscode/bin/test"
},
"devDependencies": {
"tslint": "^5.8.0",
"typescript": "^2.6.1",
"vscode": "1.1.21",
"tslint": "^5.8.0"
"vscode": "1.1.21"
},
"dependencies": {
"vscode-languageclient": "4.3.0",
"vscode-debugadapter": "1.31.0",
"vscode-debugprotocol": "1.31.0",
"@types/node": "^7.0.43",
"@types/mocha": "^2.2.42",
"@types/node": "^7.0.43",
"lua-fmt": "^2.6.0",
"smart-buffer": "^4.0.1",
"xml2js": "^0.4.19"
}
Expand Down
9 changes: 9 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import findJava from "./findJava";
import { LanguageClient, LanguageClientOptions, ServerOptions, StreamInfo } from "vscode-languageclient";
import { AttachDebuggerProvider } from './debugger/AttachDebuggerProvider';
import { MobDebuggerProvider } from './debugger/MobDebuggerProvider';
import { formatText } from 'lua-fmt';

const LANGUAGE_ID = 'lua'; //EmmyLua
export let savedContext: vscode.ExtensionContext;
Expand All @@ -30,6 +31,14 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand("emmy.restartServer", restartServer);
vscode.commands.registerCommand("emmy.showReferences", showReferences);

vscode.languages.registerDocumentFormattingEditProvider(
"lua", {
provideDocumentFormattingEdits(document, position, token): vscode.ProviderResult<vscode.TextEdit[]> {
return [new vscode.TextEdit(new vscode.Range(0, 0, document.lineCount, 0), formatText(document.getText()))];
}
}
)

const attProvider = new AttachDebuggerProvider();
savedContext.subscriptions.push(vscode.debug.registerDebugConfigurationProvider("emmylua_attach", attProvider));
savedContext.subscriptions.push(vscode.debug.registerDebugConfigurationProvider("emmylua_launch", attProvider));
Expand Down

0 comments on commit 37f5088

Please sign in to comment.