superblocks-lab icon indicating copy to clipboard operation
superblocks-lab copied to clipboard

constructor is not a highlighted language keyword

Open filippsen opened this issue 6 years ago • 5 comments

Environment/Browser

Version 1.1.0

Description

Consider updating editor syntax highlighting to comply with language version currently being used.

filippsen avatar Nov 15 '18 23:11 filippsen

@filippsen do you have any idea how VSCode actually does it? The language support in VSCode with the Solidity plugin is a lot richer than solidity support Monaco actually has. Not sure if this improvement in the syntax highlighter comes from VSCode special touch in Monaco or from the Solidity plugin itself.

javier-tarazaga avatar Nov 20 '18 15:11 javier-tarazaga

@javier-tarazaga Labs is using react-monaco-editor which depends on "monaco-editor": "^0.15.1" This in turn has a language dependancy for the syntax highlighting "monaco-languages": "1.6.0" https://github.com/Microsoft/monaco-languages/tree/master/src/solidity The solidity language pack appears to be based on solidity ^0.4.0 which is why constructor is not included in the keywords.

futurejones avatar Nov 20 '18 23:11 futurejones

A quick fix is to manually add the missing keywords to the language .js file after deployment to the server. image

futurejones avatar Nov 21 '18 00:11 futurejones

@javier-tarazaga The base Code editor doesn't show any highlighting at all when saving a file with the .sol file format. It points at the marketplace for "finding a solution". As you said, Solidity support in Code is user-created content and they all offer a lot more than just syntax highlighting, indeed. They could be used as reference, if someone finds it helpful to read from, but it is a different domain.

@futurejones explained it well. By default, Monaco ships with a set of syntax definitions and it would have to be improved by Lab, considering the original authors have not revisited it since 8 months now.

Just a small correction: Lab sets react-monaco-editor to ^0.13.0, leading to even older monaco-languages package. This apparently doesn't change anything with regards to Solidity language support. The definitions haven't been updated in a while, as very well observed.

filippsen avatar Nov 21 '18 09:11 filippsen

I have added the "constructor" keyword to the monaco-languages package. https://github.com/Microsoft/monaco-languages/pull/55 This should be included in the next monaco-editor release.

futurejones avatar Nov 30 '18 08:11 futurejones