Skip to content

Complete Emmet 2.0 support #27697

Closed
Closed

Description

Contd. from #21943

Emmet Actions:

Port current Emmet customizations to the new model:

Optimize Emmet expansions

Others:

  • Add typings

Deferred Emmet Actions:

Activity

  1. changed the title [-]Implement remaining Emmet actions using new emmet apis[/-] [+]Complete Emmet 2.0 support[/+] on Jun 12, 2017
  2. Fred-Vatin commented on Jun 13, 2017

    @Fred-Vatin

    Just to be sure the follow will be considered.

    Currently, users need to assign custom keybinding to Emmet commands to use it in a efficient workflow.

    Question 1

    I see among the available commands that Emmet has 2 flavors for some of them such as:

    emmet.nextEditPoint
    editor.emmet.action.nextEditPoint
    

    Do they refer to new vs old emmet implementation? Witch one to use in future?

    Question 2

    If user set this custom keybinding

    // Increment Number by 1
      {
          "key": "ctrl+up",
          "command": "editor.emmet.action.incrementNumberByOne",
          "when": "editorTextFocus && !editorReadonly"
      }
    

    What would be the way to only enable this keybinding according to context (when emmet can effectively use this command)?

    This would allow user to use the same keybinding for anything else or keep the default one working when the emmet context if FALSE (typically in this case: not in emmet supported language && caret not around numbers).

    // Default VSC keybinding that could keep working even with the custom emmet set by user
    {
      "key": "ctrl+up",
      "command": "scrollLineUp",
      "when": "editorTextFocus"
    }
    
  3. ramya-rao-a commented on Jun 13, 2017

    @ramya-rao-a
    ContributorAuthor

    Fremea

    To your first question:

    • When emmet.useNewEmmet is set to false, editor.emmet.action.nextEditPoint uses old implementation and emmet.nextEditPoint uses the new one
    • When emmet.useNewEmmet is set to true, editor.emmet.action.nextEditPoint calls emmet.nextEditPoint internally
    • Eventually (some time when we deprecate the setting emmet.useNewEmmet and make the new implementation the default), you will have only editor.emmet.action.nextEditPoint which will use the new implementation

    This is done so that users who have keybindings to the editor.emmet.action.... don't have to change their key bindings

    To your second question:

    The when clause can work on file types as well. So you can add resourceLangId == html and restrict few of the emmet commands based on file type. See https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts

    I don't think using cursor position is possible in the when clause.

    Hope that helps

  4. Fred-Vatin commented on Jun 13, 2017

    @Fred-Vatin

    Ramya Rao (@ramya-rao-a)

    Thanks for your answers.

    The problem with editorLangId in when clause is that you must duplicate your keybinding as many times as there are languages to restrict.

    It could be partially solved if when clause supported OR operator such as:

    "when": "editorTextFocus && ( (editorLangId == html) || (editorLangId == css) || (editorLangId == js) || (editorLangId == xml) )"

    But it wouldn't be as powerful and smart as a contextual Boolean state of command at caret position (instead of language used by file). It would allow using same keybinding for different commands in the same file depending on emmet context.

  5. nanaasumadu commented on Jun 21, 2017

    @nanaasumadu

    Ramya Rao (@ramya-rao-a)

    The new Emmet does not work in php document with embedded html. Can PHP be added to the supported language??

    A test case.

    1. Create standard html document.
    2. Change the extension from html to php
    3. Insert HTML element and child elements using emmet format.
  6. ramya-rao-a commented on Jun 21, 2017

    @ramya-rao-a
    ContributorAuthor

    Nana Asumadu (@nanaasumadu) Have you tried adding the below setting?

    "emmet.syntaxProfiles":{
    "php": "html"
    }
    
  7. nanaasumadu commented on Jun 22, 2017

    @nanaasumadu

    Ramya Rao (@ramya-rao-a)

    No, it doesn't work.

    • VSCode Version: 1.14.0-insider (1.14.0-insider), 2017-06-22T05:29:25.846Z

    • OS Version: MacOS 10.12.5

    • settings.json file:
      "emmet.useNewEmmet": true,
      "emmet.syntaxProfiles": {
      "php": "html"
      },

    Steps to Reproduce:

    1. Create a new file with .php as extension.
    2. Try to insert HTML elements using emmet syntax.
  8. ramya-rao-a commented on Jun 22, 2017

    @ramya-rao-a
    ContributorAuthor

    Nana Asumadu (@nanaasumadu) Can you try reloading VS Code after you added the syntaxProfiles setting?

  9. nanaasumadu commented on Jun 22, 2017

    @nanaasumadu

    Ramya Rao (@ramya-rao-a)

    Yes, I have reloaded VS Code and still does not work.

  10. ramya-rao-a commented on Jun 22, 2017

    @ramya-rao-a
    ContributorAuthor

    Nana Asumadu (@nanaasumadu) It works fine for me. Can you check if the language mode of your file?

    Jens Hausdorf (@jens1o) Can you give it a try? i.e Set the below, reload VS Code and see if you get emmet autcompletions in a php file?

    "emmet.syntaxProfiles": {
    "php": "html"
    }
    
  11. nanaasumadu commented on Jun 22, 2017

    @nanaasumadu

    Ramya Rao (@ramya-rao-a)

    The language mode is set to PHP. If I change the language mode to HTML, emmet auto-completion works but there is no syntax highlighting for PHP.

  12. ramya-rao-a commented on Jun 22, 2017

    @ramya-rao-a
    ContributorAuthor

    Nana Asumadu (@nanaasumadu) To ensure that no other extensions is interfering here, can you run code-insiders --disable-extensions and try again?

  13. nanaasumadu commented on Jun 22, 2017

    @nanaasumadu

    Ramya Rao (@ramya-rao-a)

    Done that and still doesn't work.

    The only option left for me now is to completely re-install code-insiders.

    Something definitely is not right.

    BTW this is my complete settings.json file:

    // Place your settings in this file to overwrite the default settings
    {
    "code-runner.runInTerminal": false,
    "code-runner.enableAppInsights": false,
    "code-runner.clearPreviousOutput": true,
    "code-runner.executorMap": {
    "javascript": "node",
    "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
    "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
    "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
    "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
    "php": "php",
    "python": "python",
    "perl": "perl",
    "ruby": "ruby",
    "go": "go run",
    "lua": "lua",
    "groovy": "groovy",
    "powershell": "powershell -ExecutionPolicy ByPass -File",
    "bat": "cmd /c",
    "shellscript": "bash",
    "fsharp": "fsi",
    "csharp": "scriptcs",
    "vbscript": "cscript //Nologo",
    "typescript": "ts-node",
    "coffeescript": "coffee",
    "scala": "scala",
    "swift": "swift",
    "julia": "julia",
    "crystal": "crystal",
    "ocaml": "ocaml",
    "r": "Rscript",
    "applescript": "osascript",
    "clojure": "lein exec",
    "haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
    "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
    "racket": "racket",
    "ahk": "autohotkey",
    "autoit": "autoit3",
    "html": "/usr/bin/open -a Opera"
    },
    // "debug.inlineValues": true,
    "deploy": {
    "clearOutputOnStartup": true,
    "openOutputOnDeploy": false,
    "showDeployResultInStatusBar": true
    },
    "editor.rulers": [
    200
    ],
    "editor.autoIndent": true,
    "editor.cursorStyle": "line-thin",
    "editor.wordWrap": "on",
    "editor.minimap.enabled": true,
    "editor.minimap.renderCharacters": true,
    "editor.dragAndDrop": true,
    "editor.renderIndentGuides": true,
    "editor.formatOnType": true,
    "editor.fontLigatures": true,
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "editor.tabCompletion": true,
    "editor.fontFamily": "FiraCode-Retina",
    "editor.fontSize": 16,
    "editor.snippetSuggestions": "top",
    "emmet.useNewEmmet": true,
    "emmet.syntaxProfiles": {
    "php": "html"
    },
    "explorer.openEditors.dynamicHeight": true,
    "explorer.openEditors.visible": 0,
    "files.exclude": {
    "/.git": true,
    "
    /.svn": true,
    "/.DS_Store": true,
    "
    /.awestruct": true,
    "/.sass-cache": true,
    "
    /_developer-materials": true,
    "/_downloads": true,
    "
    /_tmp": true,
    "/_specs": true,
    "
    /_site": true,
    "/_products": true,
    "
    /_projects": true,
    "/node_modules/": true,
    "
    /tmp/": true
    },
    "files.autoSave": "onFocusChange",
    "files.trimTrailingWhitespace": true,
    "files.associations": {
    ".bashrc": "shellscript"
    },
    "files.hotExit": "onExitAndWindowClose",
    "html.format.indentInnerHtml": true,
    "html.format.wrapAttributes": "auto",
    "html.validate.scripts": true,
    "html.validate.styles": true,
    "path-intellisense.autoSlashAfterDirectory": true,
    "php.suggest.basic": false,
    "php.validate.executablePath": "/usr/local/bin/php",
    "php.validate.enable": true,
    "php.validate.run": "onType",
    // "[php]": {
    // "editor.formatOnSave": false
    // },
    "search.useRipgrep": true,
    "search.useIgnoreFilesByDefault": true,
    "vim.easymotion": true,
    "vim.incsearch": true,
    "vim.useSystemClipboard": true,
    "vim.useCtrlKeys": true,
    "vim.hlsearch": true,
    "vim.insertModeKeyBindings": [
    {
    "before": [
    "j",
    "j"
    ],
    "after": [
    ""
    ]
    }
    ],
    "vim.otherModesKeyBindingsNonRecursive": [
    {
    "before": [
    "",
    "d"
    ],
    "after": [
    "d",
    "d"
    ]
    },
    {
    "before": [
    ""
    ],
    "after": [],
    "commands": [
    {
    "command": ":nohl"
    }
    ]
    }
    ],
    "vim.leader": "",
    "vim.handleKeys": {
    "": false,
    "": false
    },
    "window.restoreFullscreen": false,
    "workbench.sideBar.location": "right",
    "workbench.editor.showTabs": false,
    "workbench.colorTheme": "Quiet Light",
    "workbench.iconTheme": "vs-seti",
    "workbench.editor.tabCloseButton": "left",
    "window.newWindowDimensions": "inherit",
    "workbench.activityBar.visible": false,
    // "telemetry.enableCrashReporter": false,
    // "telemetry.enableTelemetry": false,
    "terminal.external.osxExec": "iTerm.app",
    "terminal.integrated.fontFamily": "FiraCode-Retina",
    "terminal.integrated.fontSize": 14,
    "terminal.integrated.confirmOnExit": true,
    "typescript.referencesCodeLens.enabled": true,
    "window.nativeTabs": true,
    "workbench.editor.closeOnFileDelete": false,
    "workbench.editor.revealIfOpen": true,
    "workbench.editor.swipeToNavigate": true,
    "workbench.welcome.enabled": true,
    // "workbench.colorCustomizations": {
    // "statusBarBackground": "#451879",
    // "editorWhitespace.foreground": "#808080",
    // // "editorCursor.foreground": "#00FFFF"
    // // "editorLineNumber.foreground": "#AA3731"
    // },
    "zenMode.hideStatusBar": true,
    "zenMode.hideTabs": true,
    "zenMode.fullScreen": false,
    "vim.disableAnnoyingNeovimMessage": true,
    "window.zoomLevel": 0,
    "window.openFilesInNewWindow": "off",
    "workspace": {}
    }

  14. nanaasumadu commented on Jun 23, 2017

    @nanaasumadu

    Ramya Rao (@ramya-rao-a)

    I have re-installed vscode insider and the problem still persist.

  15. jens1o commented on Jun 23, 2017

    @jens1o
    Contributor

    Ramya Rao (@ramya-rao-a)
    Sure, I'll try that.

    Result:

    It works. But...

    • when I write a php tag, it annoys.
    • it does not work in nowdoc nor heredoc

    ... will create a new issue for each one.

  16. jens1o commented on Jun 23, 2017

    @jens1o
    Contributor

    created #29318 and #29320

  17. nanaasumadu commented on Jun 23, 2017

    @nanaasumadu

    Ramya Rao (@ramya-rao-a)

    Thanks the issue has been resolved for me.

    The followed the steps below:

    1. Backed up my settings.json file.
    2. Uninstalled Code Insider
    3. Removed "~/Library/Applications Support/Code Insider"
    4. Removed "~/.code-insider/extensions" directory
    5. Re-installed vscode-insider
    6. Restored my settings.json
    7. Created test.php file and testing emmet expansion (that works)
    8. Re-installed extensions (emmet expansion continues to work)
  18. added
    plan-item
    on Jun 29, 2017
  19. Fred-Vatin commented on Jul 12, 2017

    @Fred-Vatin

    Ramya Rao (@ramya-rao-a)

    Good job. Thanks for your hard work for Code 1.14.0.

  20. ramya-rao-a commented on Jul 12, 2017

    @ramya-rao-a
    ContributorAuthor

    Thanks Fremea and Happy Coding!

  21. locked and limited conversation to collaborators on Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

emmetplan-item

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions