Skip to content

Conversation

@hhkaos
Copy link
Member

@hhkaos hhkaos commented Jun 11, 2021

I just wanted to do my first contribution to this project adding two very basic snippets 😄

Copy link
Member

@RalucaNicola RalucaNicola left a comment

Choose a reason for hiding this comment

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

@andygup what do you think about the ImportESM snippet? I feel like that is one way of working with esm. If users install them using node modules (which is what I guess most of our users would do) then the imports will look different. I'm not sure this is a super useful snippet.

The basemap style is good to go in my opinion.

"\t",
"\tesriConfig.apiKey = \"YOUR_FREE_API_KEY_FROM_DEVELOPERS.ARCGIS.COM\";",
"\t",
"\tconst view = new MapView({",
Copy link
Member

Choose a reason for hiding this comment

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

what is the difference between this and the CreateMap code snippet? https://github.com/Esri/arcgis-js-vscode-snippets/blob/master/snippets/javascript.json#L88

Back then we discussed that we don't want to import modules, we leave that up to the user's dev setup to be taken care of. There are many ways for a user to do that and we don't want to give them more work by having to delete our imports...

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, it is pretty similar, the main difference was the import modules. Btw, since the MapView is capable of autocast the map why do we still import the Map class and generate a variable just for the view?. In my case, I try to avoid declaring variables whenever is possible, and this is usually one of those cases.

Anyway, I think in the end, I think it is very subjective, and the type of snippets a developer would like to have/use will depend on the type of projects they use to work on (client-side, server-side, 2D, 3D, ...), so I feel that the coolest thing would be to explain how to customize the extension with your own snippets, leave it clear a contributing guide (include in the contributing.md things like what you just explained here), and in the best scenario... have something like Bootstrap customize with community contributions, allowing the developer to choose which ones likes to them 😄 (too much maybe? hehe)

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for contributing @hhkaos! I agree with @RalucaNicola that most (majority) of users are using local builds. My primary concern with the importESM snippet is that we don't want to give anyone the impression that they can use the ESM CDN in production applications. From a performance perspective, it's our most inefficient build and should only be used for prototyping and testing. Instead we are promoting npm installs of the ES modules as the best way to do local builds.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Andy, I understand. So I'll remove it and try not to add more than one snippet per PR too ^_^

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. One last recommendation, if you are able to wait 9 - 10 more days you can add this snippet along with the 4.20 release:

"<script src=\"https://js.arcgis.com/${2|4.19,4.18,4.17,4.16,4.15,4.14|}\"></script>"

Copy link
Member

Choose a reason for hiding this comment

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

  • you can add several snippets Raul, it's just that we want to stay away from using imports in them because there are several ways to import modules -> with a good setup, the editor should do that for you anyway

  • as Andi said ESM CDN is more for small demos rather than production apps

  • to answer your question about the map variable, I need the map to add layers or to find a certain layer. I guess I use a map variable to avoid having to go through the view to get it. But it's a matter of personal preference in the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

But it's a matter of personal preference in the end.

Yes you are right. In my case I think it adds extra complexity for new developers so in most cases I just try to use view.map.

@RalucaNicola
Copy link
Member

RalucaNicola commented Jun 16, 2021

In conclusion:

  • remove the importESM snippet (keep the basemap snippet)
  • update the release number

@kellyhutchins can you make a new release after UC or whenever you have a bit of time?

@RalucaNicola
Copy link
Member

I updated the comment because I thought Raul can also update the release number :D

@hhkaos hhkaos changed the title Adding 2 snippets: add importESM and basemapStyle Adding 2 snippets: add basemapStyle and adding 4.19 to getAPI Jun 16, 2021
@hhkaos
Copy link
Member Author

hhkaos commented Jun 16, 2021

Thanks @RalucaNicola, done!.

About the release number I wasn't sure what to add so I did this -> UPDATE: I did this

@kellyhutchins kellyhutchins merged commit 2369be6 into Esri:master Jun 16, 2021
@kellyhutchins
Copy link
Member

Thanks for the contribution! I am going to work on cleaning up a few of my older snippets and get the extension republished later this week.

@hhkaos
Copy link
Member Author

hhkaos commented Jun 17, 2021

thank you @kellyhutchins, if that's OK, I'll be soon doing more contributions 💪 😄

@hhkaos hhkaos mentioned this pull request Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants