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

ES6 module import improperly added to file on save #38541

Closed
julianlam opened this issue Nov 16, 2017 · 2 comments
Closed

ES6 module import improperly added to file on save #38541

julianlam opened this issue Nov 16, 2017 · 2 comments
Assignees
Labels
javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@julianlam
Copy link

julianlam commented Nov 16, 2017

  • VSCode Version: Code - Insiders 1.19.0-insider (0fbdfff, 2017-11-09T06:19:28.857Z)
  • OS Version: Linux x64 4.10.0-38-generic
  • Extensions:
Extension Author (truncated) Version
vscode-eslint dba 1.4.3

Steps to Reproduce:

  1. Create new file with #!/usr/bin/env node in the first line (then some line breaks)
  2. Type setImmediate and hit ctrl-space to trigger suggestions
  3. Select the setImmediate option that auto-imports from timers
  4. Note that import { setImmediate } from "timers"; is prepended to the file

I don't work with ES6 modules, so I may be mistaken, but the import should come after the hashbang, no?

Edit: I'm likely not understanding how imports work, and selected the auto-import option by accident. How this happened I can't explain, since the "non-import" variety comes up first if suggested.

In any case, when I try to execute my file, my cursor turns into a plus-sign-crosshair and lets me drag-select a section of the screen... which is... weird behaviour.

@vscodebot vscodebot bot added insiders javascript JavaScript support issues labels Nov 16, 2017
@julianlam
Copy link
Author

Oh interesting, somehow it triggered imagemagick to take a screenshot... and outputs a file called timers saved to the same directory.

%!PS-Adobe-3.0
%%Creator: (ImageMagick)
%%Title: (timers)
%%CreationDate: (2017-11-16T13:29:15-05:00)
%%%%BoundingBox: (atend)
%%DocumentData: Clean7Bit
%%LanguageLevel: 1
%%Orientation: Portrait
%%PageOrder: Ascend
%%Pages: 5
%%EndComments

%%BeginDefaults
%%EndDefaults

%%BeginProlog
%
% Display a color image.  The image is displayed in color on
% Postscript viewers or printers that support color, otherwise
% it is displayed as grayscale.
%
/DirectClassPacket
{
  %
  % Get a DirectClass packet.
  %
  % Parameters:
  %   red.
  %   green.
  %   blue.
  %   length: number of pixels minus one of this color (optional).
  %
  currentfile color_packet readhexstring pop pop
  compression 0 eq
  {
    /number_pixels 3 def
  }
  {
    currentfile byte readhexstring pop 0 get
    /number_pixels exch 1 add 3 mul def
  } ifelse
  0 3 number_pixels 1 sub
  {
    pixels exch color_packet putinterval
  } for
  pixels 0 number_pixels getinterval
} bind def

/DirectClassImage
{
  %
  % Display a DirectClass image.
  %
  systemdict /colorimage known
  {
    columns rows 8
    [
      columns 0 0
      rows neg 0 rows
    ]
    { DirectClassPacket } false 3 colorimage
  }
  {
    %

... with a lot more binary data afterwards

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 17, 2017

Opened microsoft/TypeScript#20088 to track the hashbang import issue

You can set "typescript.autoImportSuggestions.enabled": false to disable auto imports if they are getting in the way. The intellisense popup also shows if a symbol will be auto imported:

screen shot 2017-11-16 at 5 30 16 pm

No clue about any of the other stuff with imagemagick but it sounds unrelated to VS Code

@mjbvz mjbvz closed this as completed Nov 17, 2017
@mjbvz mjbvz added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Nov 17, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants