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

Use webpack to build the project #99

Merged
merged 1 commit into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
out
dist
node_modules
.vscode-test/
*.vsix
Expand Down
17 changes: 16 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"problemMatcher": {
"owner": "typescript",
"pattern": [
{
"regexp": "\\[tsl\\] ERROR",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "Compiler '[^']+' starting",
"endsPattern": "Compiler '[^']+' finished"
}
},
"isBackground": true,
"presentation": {
"reveal": "never"
Expand Down
7 changes: 5 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.vscode/**
.vscode-test/**
out/test/**
out/**/*.map
out/**
src/**
dist/**/*.map
.gitignore
tsconfig.json
tslint.json
Expand All @@ -13,3 +13,6 @@ scripts
javaext/**
.azure-pipelines/**
javaConfig.json
node_modules
webpack.config.js
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A lightweight extension based on [Language Support for Java by Red Hat](https://
- Lombok - Refactor code with Lombok annotations.
- Delombok - Remove annotations with actual methods.

![Screenshot](images/vscode-lombok.gif)
![Screenshot](https://raw.githubusercontent.com/microsoft/vscode-lombok/main/images/vscode-lombok.gif)

## Requirements
- VS Code (version 1.65.0 or later)
Expand Down
2,050 changes: 2,045 additions & 5 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"categories": [
"Other"
],
"main": "./out/index",
"main": "./dist/extension",
"activationEvents": [
"onLanguage:java",
"workspaceContains:pom.xml",
Expand All @@ -47,9 +47,10 @@
},
"scripts": {
"clean": "node ./node_modules/rimraf/bin.js out/",
"compile": "npm run clean && tsc -p ./",
"test": "npm run compile && node ./out/test/runTest.js",
"watch": "tsc -watch -p ./",
"test": "npm run compile && node ./out/src/test/runTest.js",
"compile": "tsc -p . && webpack --config webpack.config.js",
"watch": "webpack --config webpack.config.js --watch",
"build": "webpack --config webpack.config.js --mode=\"production\"",
"package": "vsce package",
"vscode:prepublish": "npm run compile",
"build-server": "node scripts/build/buildJdtlsExt.js"
Expand All @@ -67,7 +68,10 @@
"@types/vscode": "^1.65.0",
"glob": "^7.1.6",
"mocha": "^9.2.2",
"rimraf": "^3.0.1"
"rimraf": "^3.0.1",
"ts-loader": "^9.3.1",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"dependencies": {
"vscode-extension-telemetry-wrapper": "^0.13.2",
Expand Down
4 changes: 2 additions & 2 deletions src/codeActionProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import { commands, window, workspace, CodeActionProvider, CancellationToken, CodeAction, CodeActionContext, Command, ProviderResult, Range, Selection, TextDocument, TextEditorRevealType, CodeActionProviderMetadata, CodeActionKind, ThemeIcon, Uri, env, Disposable, QuickPickItem, QuickPickItemKind } from "vscode";
import { commands, window, workspace, CodeActionProvider, CancellationToken, CodeAction, CodeActionContext, Command, ProviderResult, Range, Selection, TextDocument, TextEditorRevealType, CodeActionKind, ThemeIcon, Uri, env, Disposable, QuickPickItem, QuickPickItemKind } from "vscode";
import { Commands, executeJavaLanguageServerCommand } from './commands';
import * as ProtocolConverter from "vscode-languageclient/lib/common/protocolConverter";
import * as CodeConverter from "vscode-languageclient/lib/common/codeConverter";
Expand Down Expand Up @@ -185,7 +185,7 @@ export class LombokCodeActionProvider implements CodeActionProvider {
};
const selectText = document.getText(range);
let codeActionTitle = "Lombok...";
let selectedAnnotations = [];
let selectedAnnotations: string[] = [];
if (selectText !== "") {
selectedAnnotations = getSelectedAnnotations(selectText);
if (selectedAnnotations.length === 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function getUserSettingsPath(platform: string): string {
return map[platform];
}

export function isLombokSupportEnabled(): boolean {
export function isLombokSupportEnabled(): boolean | undefined {
return vscode.workspace.getConfiguration().get("java.jdt.ls.lombokSupport.enabled");
}

Expand Down
21 changes: 14 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
{
"compilerOptions": {
"target": "es6",
"lib": [
"es6"
],
"module": "commonjs",
"moduleResolution": "node",
"target": "es6",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"plugins": [{ "name": "typescript-tslint-plugin" }]
"rootDir": ".",
"noUnusedLocals": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"alwaysStrict": true
},
"exclude": [
"node_modules",
"server",
".vscode-test",
"javaext",
"out"
"out",
"dist"
]
}
43 changes: 43 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

const path = require('path');

module.exports = function (env, argv) {
env = env || {};
return [{
name: 'extension',
target: 'node',
mode: 'none',
entry: {
extension: './src/index.ts'
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
use: 'ts-loader'
}]
},
resolve: {
modules: ['node_modules', path.resolve(__dirname, 'src')],
mainFiles: ['index'],
extensions: ['.js', '.ts', '.json']
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: "commonjs2",
publicPath: '/',
devtoolModuleFilenameTemplate: "../[resource-path]"
},
externals: {
'applicationinsights-native-metrics': 'commonjs applicationinsights-native-metrics', // ignored because we don't ship native module
vscode: 'commonjs vscode'
},
devtool: 'source-map',
infrastructureLogging: {
level: 'log'
}
}];
};