Skip to content

Conversation

@devvaannsh
Copy link
Member

@devvaannsh devvaannsh commented Jan 31, 2025

This PR adds built-in Emmet support to Phoenix.

Expands Emmet abbreviation on Tab key press.
Places the cursor at the correct position after expansion, in a manner that users can directly start typing.
Preserves indentation to match the surrounding code.

Untitled.video.-.Made.with.Clipchamp.4.mp4

@sonarqubecloud
Copy link

@devvaannsh devvaannsh closed this Jan 31, 2025
if (newEditor) {
// Add listener to new editor
newEditor.off("change", handleKeyEvent);
newEditor.on("keydown", handleKeyEvent);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

off, then on is usually used to prevent event handler leaks. so always do editor.off(someEvent, handler) and then editor.on(someEvent, handler)

}
if (newEditor) {
// Add listener to new editor
newEditor.off("change", handleKeyEvent);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why both change and keydown handler?

}

if (fileType === "css" || fileType === "scss" || fileType === "less") {
return { syntax: "css", type: "stylesheet" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do verify that they share the same syntax code and not a specific less syntax is present.

const fileType = editor.document.getLanguage().getId();

if (fileType === "html") {
return { syntax: "html", type: "markup" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify that emmenct can be used for php/jsp and other html like languages. Consider those languages too.

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.

2 participants