Skip to content

Commit

Permalink
merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-zhang-at-salesforce committed Nov 7, 2024
2 parents e0aa09e + 5cd0ed2 commit d8624fa
Show file tree
Hide file tree
Showing 68 changed files with 24,684 additions and 1,066 deletions.
10 changes: 7 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ updates:
directory: '/'
schedule:
interval: 'monthly'
day: 'monday'
time: '08:00'
timezone: 'America/Los_Angeles'
versioning-strategy: 'increase'
labels:
- 'dependencies'
groups:
# Group all minor and patch dependency updates together.
minor-and-patch:
applies-to: version-updates
update-types:
- 'minor'
- 'patch'
open-pull-requests-limit: 5
pull-request-branch-name:
separator: '-'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: '20.x'

- name: Install dependencies
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 18, 20 ]
node: [ 20 ]
name: Linting on Ubuntu with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 18, 20 ]
node: [ 20 ]
name: Prettier on Ubuntu with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: '20.x'

- name: Install dependencies
run: npm install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 18, 20 ]
node: [ 20, 22 ]
name: Tests with code coverage on Ubuntu with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
Expand All @@ -25,7 +25,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
node: [ 18, 20 ]
node: [ 20, 22 ]
name: Tests with code coverage on Windows with Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules
coverage/
.nyc_output/
.DS_Store
**/*.tsbuildinfo
78 changes: 50 additions & 28 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,54 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/lsp/client/out/**/*.js",
"${workspaceFolder}/lsp/server/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}",
"autoAttachChildProcesses": true
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/lsp/client/out/**/*.js",
"${workspaceFolder}/lsp/server/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}",
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Mocha LSP Server Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--no-timeouts",
"--colors",
"--stdio",
"--inspect-brk",
"--require",
"ts-node/register",
"${workspaceFolder}/lsp/server/out/test/**/*.test.js"
],
"internalConsoleOptions": "openOnSessionStart",
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/lsp/server/out/test/**/*.test.js"]
}
]
}
89 changes: 89 additions & 0 deletions lsp/client/package-lock.json

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

14 changes: 14 additions & 0 deletions lsp/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "mobile-lsp-client",
"description": "Client for the Salesforce Mobile Language Server, enabling language support for mobile development in VSCode.",
"license": "MIT",
"version": "0.0.1",
"main": "out/extension.js",
"publisher": "salesforce",
"engines": {
"vscode": "1.77.0"
},
"dependencies": {
"vscode-languageclient": "^9.0.1"
}
}
83 changes: 83 additions & 0 deletions lsp/client/src/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2024, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

import * as path from 'path';
import { workspace, ExtensionContext } from 'vscode';

import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind
} from 'vscode-languageclient/node';

let client: LanguageClient;

export function activate(
context: ExtensionContext,
updateDiagnosticsSettingCommand: string,
diagnosticsSettingSection: string
) {
// The server is implemented in node
const serverModule = context.asAbsolutePath(
path.join('lsp/server', 'out', 'server.js')
);

// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: {
module: serverModule,
transport: TransportKind.ipc
}
};

// Get extension name
const extensionTitle =
context.extension.packageJSON.contributes.configuration.title;

// Options to control the language client
const clientOptions: LanguageClientOptions = {
documentSelector: [
// Watch all js and html files, to be fine-tuned to watch for files in LWC bundle.
{ scheme: 'file', language: 'javascript' },
{ scheme: 'file', language: 'html' }
],
synchronize: {
// '.sf/config.json' and '.sfdx/sfdx-config.json' in the workspace is updated when org is authorized, switched or logged out by sf core extension.
// Notify the server to re-evaluate for the updated org.
fileEvents: [
workspace.createFileSystemWatcher('**/.sf/config.json'),
workspace.createFileSystemWatcher('**/.sfdx/sfdx-config.json')
]
},
initializationOptions: {
extensionTitle,
updateDiagnosticsSettingCommand,
diagnosticsSettingSection
}
};

// Create the language client and start the client.
client = new LanguageClient(
'LSP Mobile',
'LSP Mobile Client',
serverOptions,
clientOptions
);

// Start the client. This will also launch the server
client.start();
}

export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}
19 changes: 19 additions & 0 deletions lsp/client/src/test/diagnostic-gql.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2024, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import * as vscode from 'vscode';
import * as assert from 'assert';
import { getDocUri, activate } from './helper';
import * as sinon from 'sinon';

import { afterEach } from 'mocha';

suite('GraphQL Diagnostics Test Suite - Client', () => {
afterEach(function () {
sinon.restore();
});
test('Dummy gql test', async () => {});
});
Loading

0 comments on commit d8624fa

Please sign in to comment.