Skip to content

Commit

Permalink
Merge pull request #304 from codefori/feature/disable_stuff_in_merlin'
Browse files Browse the repository at this point in the history
Turn off tools based on environment
  • Loading branch information
worksofliam authored Mar 6, 2024
2 parents a6aa356 + d6819fa commit 7d51b7b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,4 @@ jobs:
# Create and publish build to OpenVSX
- name: Publish to Open VSX
run: npx ovsx publish -p ${{ secrets.OPENVSX_TOKEN }}

# Create linter only build
- name: Create linter only build (Merlin)
run: npm run package:linter
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: vscode-rpgle-linter-only
path: ./*.vsix

5 changes: 5 additions & 0 deletions extension/server/src/data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Declaration from '../../../language/models/declaration';
import { getPrettyType } from '../../../language/models/fixed';

export function isInMerlin(): boolean {
const { MACHINE_EXEC_PORT } = process.env;
return MACHINE_EXEC_PORT !== undefined;
}

export function parseMemberUri(path: string): {asp?: string, library?: string, file?: string, name: string} {
const parts = path.split(`/`).map(s => s.split(`,`)).flat().filter(s => s.length >= 1);
return {
Expand Down
10 changes: 6 additions & 4 deletions extension/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { getPrettyType } from '../../../language/models/fixed';
import * as Project from './providers/project';
import workspaceSymbolProvider from './providers/project/workspaceSymbol';
import implementationProvider from './providers/implementation';
import { dspffdToRecordFormats, parseMemberUri } from './data';
import { dspffdToRecordFormats, isInMerlin, parseMemberUri } from './data';
import path = require('path');
import { existsSync } from 'fs';
import { renamePrepareProvider, renameRequestProvider } from './providers/rename';
Expand All @@ -35,9 +35,11 @@ let hasConfigurationCapability = false;
let hasWorkspaceFolderCapability = false;
let hasDiagnosticRelatedInformationCapability = false;

const languageToolsEnabled = process.env.LANGUAGE_TOOLS_ENABLED;
const linterEnabled = process.env.LINTER_ENABLED;
const formatterEnabled = process.env.FORMATTER_ENABLED;
const outsideMerlin = !isInMerlin();

const languageToolsEnabled = outsideMerlin;
const linterEnabled = true;
const formatterEnabled = outsideMerlin;

let projectEnabled = false;

Expand Down
7 changes: 0 additions & 7 deletions extension/server/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,4 @@ module.exports = withDefaults({
filename: `server.js`,
path: path.join(__dirname, `..`, `..`, `out`)
},
plugins: [
new webpack.DefinePlugin({
'process.env.LANGUAGE_TOOLS_ENABLED': process.env.LANGUAGE_TOOLS_ENABLED || `true`,
'process.env.LINTER_ENABLED': process.env.LINTER_ENABLED || `true`,
'process.env.FORMATTER_ENABLED': process.env.FORMATTER_ENABLED || `true`,
}),
],
});
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"test": "vitest run",
"test:watch": "vitest",
"package": "vsce package",
"package:linter": "LANGUAGE_TOOLS_ENABLED=\"false\" FORMATTER_ENABLED=\"false\" vsce package",
"vscode:prepublish": "npm run webpack",
"webpack": "npm run clean && webpack --mode production --config ./extension/client/webpack.config.js && webpack --mode production --config ./extension/server/webpack.config.js",
"webpack:dev": "npm run clean && webpack --mode none --config ./extension/client/webpack.config.js && webpack --mode none --config ./extension/server/webpack.config.js",
Expand Down

0 comments on commit 7d51b7b

Please sign in to comment.