-
Notifications
You must be signed in to change notification settings - Fork 122
Fix empty editor bug #9996
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
Merged
Merged
Fix empty editor bug #9996
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
54bd1b1
Fix empty editor bug
nstrayer cebc119
Unskip test
nstrayer 7005201
Make sure to keep focus on the correct notebook and also to make sure…
nstrayer ac5d387
Switch to grabbing instance from active editor rather than from the n…
nstrayer 7d11fd8
Remove all uses of the notebook service active instance getter
nstrayer 5d29dcd
Make tab name for untitled notebook a regular expression
nstrayer 93e01ee
Rename utility instance getter to match upstream better.
nstrayer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/vs/workbench/contrib/positronNotebook/browser/notebookUtils.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (C) 2025 Posit Software, PBC. All rights reserved. | ||
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { IEditorService } from '../../../services/editor/common/editorService.js'; | ||
import { IPositronNotebookInstance } from './IPositronNotebookInstance.js'; | ||
import { PositronNotebookEditor } from './PositronNotebookEditor.js'; | ||
import { POSITRON_NOTEBOOK_EDITOR_ID } from '../common/positronNotebookCommon.js'; | ||
|
||
/** | ||
* Retrieves the active Positron notebook instance from the editor service. | ||
* | ||
* @param editorService The editor service | ||
* @returns The active notebook instance, or undefined if no Positron notebook is active | ||
*/ | ||
export function getNotebookInstanceFromEditorPane(editorService: IEditorService): IPositronNotebookInstance | undefined { | ||
const activeEditorPane = editorService.activeEditorPane; | ||
|
||
// Check if the active editor is a Positron Notebook Editor | ||
if (!activeEditorPane || activeEditorPane.getId() !== POSITRON_NOTEBOOK_EDITOR_ID) { | ||
return undefined; | ||
} | ||
|
||
// Extract the notebook instance from the editor | ||
const activeNotebook = (activeEditorPane as PositronNotebookEditor).notebookInstance; | ||
return activeNotebook; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.