-
Notifications
You must be signed in to change notification settings - Fork 9
Fix packaging #157
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
Fix packaging #157
Conversation
|
||
const SETTING_KEY_SUPPRESS_ALL = 'suppressAll'; | ||
const SETTING_KEY_SUPPRESS_BY_RULE_ID = 'suppressByRuleId'; | ||
|
||
export function getUpdateDiagnosticsSettingCommand( | ||
context: vscode.ExtensionContext | ||
): string { | ||
return `${getExtensionName(context)}.updateDiagnosticsSetting`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getExtensionName()
was only used here so no need to have a method defined in workspaceUtils.ts
.
import { WorkspaceFolder } from 'vscode-languageserver'; | ||
|
||
export class WorkspaceUtils { | ||
// WorkspaceFolders is null if Workspace is not configured | ||
export class ServerWorkspace { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much of ServerWorkspace
came from WorkspaceUtils
which most of it was a code from previous iteration prior to LSP. The reason LSP needs a ServerWorkspace
was because it wanted to stash workspaceFolders
property(next line in the code) that gets passed to when the LSP server is initialized.
Rather than duplicating WorkspaceUtils
, I created a property bag class with managing workspaceFolders
property. Static methods are essentially the same as they were implemented when LSP feature was done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.... I'm not sure how I feel about ServerWorkspace
as the name and I think we should stick to the original class+file name. This file contains helper code around the concept of Workspace in an extension, and to that end Server
or Client
workspace doesn't make sense (not to me at least).... but I'll differ to others on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline and will keep as is in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WorkSpaceFolder in the LSP server and VS Code are two distinct classes. In the previous workspace structure, the server and client were independent packages, so using workspace as a name made sense within a self-contained project. Now that we've consolidated everything into a single package, renaming it to ServerWorkSpace is more appropriate to distinguish it from VS Code's workspace.
export const CORE_EXTENSION_ID = 'salesforce.salesforcedx-vscode-core'; | ||
export const SFDX_PROJECT_FILE = 'sfdx-project.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constants, too, were originally defined in root, which moved to LSP server and then reverse exported back to the root project. Since we're consolidating they're back to where they were.
key: 'target-org' | ||
}; | ||
|
||
export class TempProjectDirManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TempProjectDirManager
coming back to the file where it was originally.
test/suite/lsp/server/diagnostics/gql/over-sized-record.test.ts
Outdated
Show resolved
Hide resolved
@@ -24,7 +24,7 @@ export function activate( | |||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is renamed from extension.ts
to client.ts
. Extension.ts
should be used for the main entry point in an extension. So following the same spirit as lsp/server
I named it client.ts
. I thought of changing activate()
too since it could be anything if it is not an extension. Besides, it's taking extra parameters in updateDiagnosticSettingCommand
and diagnosticSettingSection
that aren't expected by extension loader. But changing the file name suffices so I left activate()
as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments for your considerations. For some of the feedback we can see how the rest of the team feels about them so don't feel obligated to change things right away... if others are ok with the way things are in your PR then we can go as is.
Nit: Do we need a |
@khawkins |
We lost |
6861c18
to
ddac535
Compare
865a22b
to
be50e99
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good for me, great job.
Co-authored-by: Kevin Hawkins <khawkins@salesforce.com>
be50e99
to
0a90efa
Compare
"compile": "rimraf ./out/tsconfig.tsbuildinfo && tsc -b ./ && npm run copy-yaml", | ||
"copy-yaml-win": "mkdir out\\src\\resources && copy resources\\component-experiences.yaml out\\src\\resources", | ||
"copy-yaml-unix": "mkdir -p ./out/src/resources && cp ./resources/component-experiences.yaml ./out/src/resources", | ||
"copy-yaml": "npm run copy-yaml-win || npm run copy-yaml-unix", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This...is not my favorite, relying on fatal errors in the shell to take affirmative alternative action. It can be risky, and is otherwise not super intuitive. A more standard and maintainable way to do this would be to create a basic Node utility module to manage the logic. We know we have a Node.js environment in either case, so we can write a pretty simple OS-agnostic script with fs
, path
, and os
to do the copying, give it an identifiable name, and voila, maintainable code. 🙂
It's slightly more code than this, but IMO it's easier to maintain, and more intuitive to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me take care in another PR. (This PR got merged few minutes ago.)
I think I remember why I had yaml
folder under resources
folder. It's because I was able to use cp -r
. Since the yaml file was move and cp
was failing on copying a single file claiming it can't find resources
folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Great job!
@@ -60,8 +60,8 @@ export function activate( | |||
|
|||
// Create the language client and start the client. | |||
client = new LanguageClient( | |||
'LSP Mobile', | |||
'LSP Mobile Client', | |||
'Salesforce Mobile Language Server', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This first item would typically be an identifier, e.g. salesforceMobileLanguageServer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Will take care of this along with the above feedback that you made.
What does this PR do?
This PR consolidates 3 packages into one. There were 3 packages:
Consolidation allows:
npx vsce package
wasn't supporting symbolic links thus not producingvsix
distributable.