Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic integration with Language Server #466

Merged
merged 26 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d3c07ea
Update status bar item text
mark-wiemer Aug 18, 2024
16a2b40
Mark v2 for LSP
mark-wiemer Aug 18, 2024
8c0cfb8
Fixup build and run `activateV2` on activate
mark-wiemer Aug 18, 2024
b935408
Fixup Test Extension launch config
mark-wiemer Aug 21, 2024
f82e001
Remove activateV2 for now
mark-wiemer Aug 21, 2024
d4379e5
Document launch issues
mark-wiemer Aug 21, 2024
8292654
Update package lock for engine 1.90
mark-wiemer Aug 21, 2024
7704ed8
Activate v2 and log both funcs
mark-wiemer Aug 21, 2024
c7f0eb9
Remove Run and Debug viewlet support
mark-wiemer Aug 21, 2024
ea7a12e
Add v2 launch configs (mostly working)
mark-wiemer Aug 21, 2024
983de7e
Test with `Ctrl+F1` works
mark-wiemer Aug 21, 2024
dc81b35
Improve launch resiliency
mark-wiemer Aug 21, 2024
2eab31e
Connect to server :)
mark-wiemer Aug 21, 2024
21f8671
Build ahk2 project on launch
mark-wiemer Aug 21, 2024
5c776cb
Use Insiders for manual testing
mark-wiemer Aug 21, 2024
c7c43d3
Cleanup v1 activate
mark-wiemer Aug 21, 2024
35d5668
Fix launch config again again again lol
mark-wiemer Aug 21, 2024
87bd079
Connect to language server!!
mark-wiemer Aug 21, 2024
91f5eea
Fixup launch config final
mark-wiemer Aug 21, 2024
297cc81
Remove build echos
mark-wiemer Aug 21, 2024
00a3006
Fixup packaging!
mark-wiemer Aug 21, 2024
d469b43
Add manual test for integration and readme
mark-wiemer Aug 21, 2024
4846528
update to main branch of submodule
mark-wiemer Aug 21, 2024
916d203
restore husky
mark-wiemer Aug 21, 2024
06a3471
Merge branch 'main' into users/markwiemer/add-lsp
mark-wiemer Aug 21, 2024
c150e9b
Fixup dev docs
mark-wiemer Aug 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// See `code --help` for launch args
{
"version": "0.2.0",
"configurations": [
{
"type": "ahk2",
"request": "launch",
"name": "AutoHotkey v2 Debugger",
"program": "${file}",
"stopOnEntry": true,
"runtime": "C:\\Program Files\\AutoHotkey\\v2\\AutoHotkey64.exe"
},
{
"type": "ahk",
"request": "launch",
"name": "AutoHotkey v1 Debugger",
"program": "${file}",
"stopOnEntry": true,
"runtime": "C:\\Program Files\\AutoHotkey\\v1.1.37.01\\AutoHotkeyU64.exe"
},
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
// "outFiles": ["${workspaceRoot}/out/**/*.js"],
"preLaunchTask": "build:dev"
"outFiles": ["${workspaceRoot}/out/**/*.js"],
"preLaunchTask": "npm: build:dev"
},
{
"name": "Test Extension",
Expand All @@ -36,10 +21,10 @@
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
"--extensionTestsPath=${workspaceFolder}/out/src/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "npm: compile"
"preLaunchTask": "npm: compile-ts"
}
]
}
34 changes: 0 additions & 34 deletions .vscode/tasks.json

This file was deleted.

2 changes: 1 addition & 1 deletion ahk2
Submodule ahk2 updated from c95899 to bfda9c
15 changes: 0 additions & 15 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,7 @@ build({
external: ['vscode'],
format: 'cjs',
platform: 'node',
// logLevel: 'error',
metafile: true,
// sourceRoot: __dirname+"/src",
minify: isProd,
sourcemap: !isProd,
plugins: [
{
name: 'build notice',
setup(build) {
build.onStart(() => {
console.log('Build start');
});
build.onEnd(() => {
console.log('Build success');
});
},
},
],
});
3 changes: 3 additions & 0 deletions demos/manualTests/_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## AHK++ manual tests

As a final sanity check, here are some manual tests to run. Be sure to packag the extension and install from VSIX before executing them. Each file describes itself. Feel free to open a discussion if you have any questions :)
5 changes: 5 additions & 0 deletions demos/manualTests/rename.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Requires AutoHotkey v2.0

; F2 renames variables
b := 1
b := 2
6 changes: 5 additions & 1 deletion docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ This document covers the development process, from writing code to publishing a
## Testing

- Test all added commands
- If the readme was modified, confirm it appears as intended
- If the readme was modified, confirm it appears as intended in a non-GitHub viewer (Ctrl+Shift+V in VS Code is sufficient)

### Launch Extension troubleshooting

In the Run and Debug viewlet, the "Launch Extension" config is best for manual testing. [\_readme.md](../demos/manualTests/_readme.md) covers how those tests work.

## Starting a release

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"publisher": "mark-wiemer",
"main": "./dist/extension",
"files": [
"ahk2/server/dist/*",
"ahk2/syntaxes/ahk2_common.json",
"language/ahk.configuration.json",
"language/ahk.tmLanguage.json",
"language/ahk2.tmLanguage.json",
Expand All @@ -41,13 +43,14 @@
"license.txt"
],
"scripts": {
"build": "node build.mjs --mode=production",
"build:dev": "node build.mjs",
"build": "node build.mjs --mode=production && cd ahk2 && npm run build",
"build:dev": "node build.mjs && cd ahk2 && npm run build:dev",
"clean:all": "npm run clean:dist && npm run clean:language && npm run clean:out",
"clean:dist": "del-cli dist",
"clean:language": "del-cli language/*.tmLanguage.json",
"clean:out": "del-cli out",
"compile-grammar": "js-yaml language/ahk.tmLanguage.yaml > language/ahk.tmLanguage.json && js-yaml language/ahk2.tmLanguage.yaml > language/ahk2.tmLanguage.json",
"precompile-ts": "npm run clean:out",
"compile-ts": "tsc -b",
"eslint": "npm run eslint:files -- src && echo No ESLint problems",
"eslint:files": "eslint --max-warnings=0",
Expand All @@ -62,7 +65,7 @@
"test": "npm run test-grammar && npm run test-unit",
"pretest-grammar": "npm run compile-grammar",
"test-grammar": "vscode-tmgrammar-snap language/samples/*.{ahk1,ahk2}",
"pretest-unit": "npm run clean:out && npm run compile-ts",
"pretest-unit": "npm run compile-ts",
"test-unit": "node ./out/src/test/runTest.js",
"validate": "npm run lint && npm run test && npm run package",
"vscode:prepublish": "npm run build && echo Packaging..."
Expand Down
1 change: 1 addition & 0 deletions src/common/codeUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class CodeUtil {
}

/** Whether the current active text editor is for an AHK v1 file */
// todo use LSP for all v2 functionality
export const isV1 = (): boolean =>
vscode.window.activeTextEditor?.document.languageId === LanguageId.ahk1;

Expand Down
12 changes: 8 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ import { Global, ConfigKey } from './common/global';
import { AhkRenameProvider } from './providers/ahkRenameProvider';
import { SignatureProvider } from './providers/signatureProvider';
import { CompletionProvider } from './providers/completionProvider';
import { openHelp } from './service/helpService';
// import { openHelp } from './service/helpService';
import { initializeLanguageVersionService } from './service/languageVersionService';
import { activate as activateV2 } from '../ahk2/client/src/extension';

export function activate(context: vscode.ExtensionContext) {
console.log('ahk++ activated');
(async () => {
Global.updateStatusBarItems('Indexing AutoHotkey Workspace...');
Global.updateStatusBarItems('Indexing AutoHotkey workspace...');
await Parser.buildByPath(vscode.workspace.rootPath);
Global.updateStatusBarItems('Index Workspace Success!');
Global.updateStatusBarItems('Indexed AutoHotkey workspace :)');
Global.hide();
})();

Expand Down Expand Up @@ -70,7 +72,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('ahk++.debug', () =>
RunnerService.startDebugger(),
),
vscode.commands.registerCommand('ahk++.openHelp', openHelp),
// vscode.commands.registerCommand('ahk++.openHelp', openHelp), // leave this to the v2 extension for now
vscode.commands.registerCommand('ahk++.run', () => RunnerService.run()),
vscode.commands.registerCommand('ahk++.runSelection', () =>
RunnerService.runSelection(),
Expand All @@ -86,6 +88,8 @@ export function activate(context: vscode.ExtensionContext) {
),
);
}

activateV2(context);
}

class InlineDebugAdapterFactory
Expand Down
Loading