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

Enhance the global object #14

Merged
merged 5 commits into from
Jan 3, 2025
Merged

Enhance the global object #14

merged 5 commits into from
Jan 3, 2025

Conversation

kazssym
Copy link
Owner

@kazssym kazssym commented Jan 3, 2025

PR Classification

Code enhancement and documentation update.

PR Summary

This pull request enhances the ExtensionEntrypoint.cs and GlobalObject.cs files with improved error handling, documentation, and new properties, along with adding a new localized string.

  • ExtensionEntrypoint.cs: Added copyright notice, handled potential null basePath, replaced extensibility with globalObject, and updated publisherName.
  • GlobalObject.cs: Made class public, added documentation comments, introduced and initialized new properties.
  • Strings.Designer.cs and Strings.resx: Added new localized string ScriptOutputChannelName.
  • __init__.js: Updated to write a message to the output channel.

Introduce `ScriptOutputChannelName` in `Strings.Designer.cs` and `Strings.resx`.
- Added property `ScriptOutputChannelName` in `Strings.Designer.cs`.
- Added entry for `ScriptOutputChannelName` in `Strings.resx` with value "VSExtension1 Script".
- Made GlobalObject class public and added XML documentation.
- Updated constructor to accept IServiceProvider.
- Added using directives for various Microsoft namespaces.
- Introduced properties for JoinableTaskFactory and VisualStudioExtensibility.
- Added private readonly field _outputChannel, initialized asynchronously.
- Added public property Output to provide TextWriter for scripts.
Introduce AGPL-3.0 license notice in ExtensionEntrypoint.cs.
Handle null directory in CreateScriptEngine with default ".".
Create GlobalObject using serviceProvider directly.
Update ExtensionConfiguration publisherName to "Kaz Nishimura".
Added a line of code to the `__init__.js` file that writes "Hello from __init__.js" to the output using the `extension.Output.WriteLine` method. This change helps confirm that the initialization script is executed correctly.
The GlobalObject instantiation has been moved outside of the try
block to ensure it is created before any potential exceptions are
caught. This change allows the globalObject to be used in the catch
blocks. Specifically, the ScriptEngineException catch block now
writes the exception message to globalObject.Output instead of
having a TODO comment.
@kazssym kazssym merged commit ced85a1 into main Jan 3, 2025
1 check passed
@kazssym kazssym deleted the update-global-object branch January 3, 2025 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant