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

Detect Language Mode from Modeline Comment #1651

Closed
bloudraak opened this issue Dec 25, 2015 · 7 comments
Closed

Detect Language Mode from Modeline Comment #1651

bloudraak opened this issue Dec 25, 2015 · 7 comments
Labels
*extension-candidate Issue identified as good extension implementation feature-request Request for new features or functionality
Milestone

Comments

@bloudraak
Copy link

I use Vagrant a bit. The file Vagrantfile is extensionless and as a result is shown as plain text. The file is actually a ruby script. You can see it in the comments; something vim and vi support.

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|

end 

It would be extremely useful if VisualStudio Code could honor those settings and display the file in the correct language mode. It would even be better if other settings, like tab length etc could be honored. I'm assuming the latter will overwrite the workspace and user settings.

Modeline magic
http://vim.wikia.com/wiki/Modeline_magic

@bpasero bpasero changed the title Detect Language Mode from Comment Detect Language Mode from Modeline Comment Dec 28, 2015
@bpasero bpasero added the feature-request Request for new features or functionality label Dec 28, 2015
@bpasero bpasero added this to the Backlog milestone Dec 28, 2015
@ctlajoie
Copy link

I am writing a modelines plugin that will support vim/emacs modelines as well as a Code-specific syntax. It's working fine for tabs/spaces and tab width settings, but I don't believe there is a way to set the language yet through the (documented) API. Can anyone more familiar with it than I am confirm whether this is the case?

If it's not possible then I guess I will have to release the plugin without this functionality and add it when there is an API for it.

@ctlajoie
Copy link

The extension is published, if anyone is interested.
https://marketplace.visualstudio.com/items/chrislajoie.vscode-modelines

@bbenoist
Copy link

@bloudraak You might also be interested in my new Vagrant extension 😉 :

@lloeki
Copy link
Contributor

lloeki commented Aug 4, 2017

This would be awesome to have. I regularly have ext-less files around in various projects of mine or other that get source/require/loaded and there's nothing more accurate and efficient than a modeline to have some things set up correctly.

@ev0rtex
Copy link

ev0rtex commented Oct 31, 2017

I have many files that I need to be able to set the filetype/language/whatever based on a modeline. I have done this in SublimeText for years using an extension that enables it. From reading here it seems that what's needed is for the plugin API to support setting the language mode and then this functionality could be properly implemented. It would be great to see this!

@bpasero bpasero added the editor label Nov 11, 2017
@alexdima alexdima added the *extension-candidate Issue identified as good extension implementation label Nov 22, 2017
@vscodebot
Copy link

vscodebot bot commented Nov 22, 2017

This issue has been closed because it is not within the scope of the core product, but could be addressed by an extension. The VS Code Marketplace shows all existing extensions and you can get started writing your own extension in a few simple steps. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Nov 22, 2017
@lloeki
Copy link
Contributor

lloeki commented Nov 22, 2017

not within the scope of the core product, but could be addressed by an extension.

True, but only insofar as #1800 is ever going to be resolved.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*extension-candidate Issue identified as good extension implementation feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

7 participants