Giter VIP home page Giter VIP logo

language-typescript's Introduction

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

TypeScript language support in Atom

CI

Dependency Status

Adds syntax highlighting and snippets for TypeScript in Atom.

The grammar is the Microsoft TypeScript TextMate grammar and copied here on a semi-regular basis. Any issues relating to syntax highlighting are likely to be there.

language-typescript's People

Contributors

ben3eee avatar damieng avatar darangi avatar jorys-paulin avatar lee-dohm avatar lkashef avatar maxbrunsfeld avatar taylon avatar torn4dom4n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

language-typescript's Issues

Support for Styled Components?

The language-babel package for Atom includes special highlighting rules that support Styled Components, highlighting tagged template literals starting with styled as CSS:

screenshot

Are there any plans for similar support in language-typescript? What would the path to that kind of support look like? Happy to try for a PR if there's a wish for it.

Failed to load a language-typescript package grammar

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.32.0 ia32
Electron: 2.0.9
OS: Microsoft Windows 8.1 Enterprise
Thrown From: language-typescript package 0.4.6

Stack Trace

Failed to load a language-typescript package grammar

At The specified module could not be found.
\\?\C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node in C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar\node_modules\language-typescript\grammars\tree-sitter-typescript.json

Error: The specified module could not be found.
\\?\C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:180:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:145671)
    at /app.asar/node_modules/tree-sitter-typescript/index.js:2:20)
    at /app.asar/node_modules/tree-sitter-typescript/index.js:11:3)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:146381)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:149928)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (internal/module.js:11:18)
    at customRequire (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:1:622321)
    at new TreeSitterGrammar (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:2952432)
    at GrammarRegistry.createGrammar (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:356290)
    at l.readFile (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:356131)
    at u (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:575466)
    at ~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:576719
    at ELECTRON_ASAR.js:530:9
    at FSReqWrap.wrapper [as oncomplete] (fs.js:658:17)
  at /app.asar/node_modules/language-typescript/grammars/tree-sitter-typescript.json:1:1

Commands

Non-Core Packages


Package snippets don't work

Prerequisites

Description

The snippets for the typescript language don't work. Their neither show up in the autocomplete dialog, or when hitting Tab after typing them.
This issue happens whether or not the file is saved, and whether or not your're running Atom vanilla (or in safe mode) or with additional packages. I do not have the atom-typescript package installed.

Steps to Reproduce

  1. Open Atom
  2. Create a new TypeScript file and save it
  3. Start typing class, which according to the snippets file, should complete with a class definition

Expected behavior:

  • The autocomplete dialog is supposed to show up
  • After typing class, the snippet is supposed to autocomplete

Actual behavior:

  • The autocomplete dialog doesn't show up
  • Hitting Tab after typing class just adds a space

Reproduces how often:

This issues happens everytime, on normal Atom or when in safe mode

Versions

  • Atom:
Atom    : 1.40.1
Electron: 3.1.10
Chrome  : 66.0.3359.181
Node    : 10.2.0
  • APM:
apm  2.4.3
npm  6.2.0
node 10.2.1 x64
atom 1.40.1
python 2.7.15
git 2.22.0.windows.1
visual studio 2015

I'm running Windows 10 version 1903 / 18362.356

Additional Information

I've forked this repository and added a file called language-typescript.cson inside the snippets directory with the same contents as the language-javascript.cson file from the language-javascript package, edited the first line from '.source.js, .source.flow' to '.source.ts, .source.tsx' and the snippets worked again.

However, I also changed the body part of each snippet in the JSON files to be strings instead of arrays of strings, and the snippets worked again. I think that's what causing the issue here.

`language-typescript` "steals" .js files from `language-babel` when tree-sitting enabled

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:

Description

When tree-sitting enabled, language-typescript sets the scope of all .js files in projects with a .flowconfig file to flow-javascript.

This overrules the scope for language-babel which is the preferred grammar plugin for Nuclide and breaks all the useful IDE features for Flow.

No idea if this considered a bug but hopefully the presence of this ticket is helpful to other intrepid people who enable new features to test and run into these problems! This puzzled me specifically because I use language-babel and thus have language-javascript disabled, couldn't find the flow-javascript scope string mentioned in any of my installed packages, and didn't think about language-typescript as a thing that would affect JavaScript files, but eventually searched for the scope string on the atom repos and found it.

Steps to Reproduce

  1. Install nuclide and language-babel
  2. Enable tree-sitting in preferences
  3. Open a .js file in a project with a .flowconfig

Expected behavior:

Automatic grammar selection should be "Babel". Useful features like hovering variables to see their type, autocomplete, etc, should work.

Actual behavior:

Grammar selection is "Flow JavaScript". None of the above useful features work.

Reproduces how often:

Always

Versions

Ubuntu 16.04

$ atom-beta --version
Atom    : 1.27.0-beta1
Electron: 1.7.11
Chrome  : 58.0.3029.110
Node    : 7.9.0
awilkins@ryoko:~ 
$ apm-beta --version
apm  1.19.0
npm  3.10.10
node 6.9.5 x64
atom 1.27.0-beta1
python 2.7.12
git 2.7.4

Additional Information

Workarounds

  • Disable tree-sitting OR
  • Disable language-typescript

Classes with generic mixins applied to base do not highlight correctly #1573

Prerequisites

Description

Generic-Mixin-applying classes do not highlight correctly.

Steps to Reproduce

Consider this file:

interface C {}
class B<T, U> {}

function F(s: any) { return class G<T, U> extends s {} }

export class A extends F(B)<D, E> implements C {}

export class A extends B<D, E> implements C {}

Expected behavior:

Expected: both instances of the word implements highlight as modifier keywords

Actual behavior:

Actual: only the second instance highlights properly

Screen Shot 2021-02-08 at 10 20 09

Screen Shot 2021-02-08 at 10 20 16

Reproduces how often:

Versions

atom: 1.54.0
macOS: 10.14.6

Additional Information

Edit: having submitted this issue I'm now noticing that GitHub's highlighter appears to have the same issue, so maybe it's upstream. However note VSCode's rendering:

Screen Shot 2021-02-08 at 10 24 54

debug info with package info
{
  "atom": "1.54.0",
  "platform": "darwin",
  "release": "18.7.0",
  "activeCommunityPackages": [
    "dracula-syntax: 3.0.2",
    "framer-ui: 2.0.0",
    "api-docs: 0.0.6",
    "atom-ide-debugger-node: 0.7.3",
    "atom-ide-debugger-python: 0.7.3",
    "atom-ide-javascript: 1.5.0",
    "atom-import-cost: 1.2.0",
    "atom-inline-blame: 0.0.10",
    "atom-jq: 0.7.0",
    "atom-typescript: 14.1.2",
    "audio: 1.5.7",
    "autocomplete-module-import: 0.3.0",
    "autocomplete-paths: 2.12.18",
    "busy-signal: 2.0.1",
    "choose-pane: 0.8.0",
    "color-picker: 2.3.0",
    "counter: 0.3.5",
    "custom-title: 1.0.1",
    "docblockr: 0.13.7",
    "emmet: 2.4.3",
    "file-icons: 2.1.46",
    "gitlab-integration: 0.4.8",
    "haskell-debug: 0.3.6",
    "haskell-pointfree: 0.2.0",
    "highlight-column: 0.5.4",
    "highlight-line: 0.12.0",
    "highlight-selected: 0.17.0",
    "ide-bash: 1.0.11",
    "ide-cpp: 0.1.0",
    "ide-haskell-hoogle: 0.1.2",
    "ide-html: 0.6.2",
    "ide-json: 0.2.1",
    "indent-guide-improved: 1.4.13",
    "intentions-colorpicker: 1.0.1",
    "intentions-numbers: 1.0.4",
    "javascript-drag-import: 0.1.13",
    "language-haskell-scoped: 0.1.2",
    "less-than-slash: 0.20.0",
    "linter-coverage: 0.3.0",
    "linter-docker: 0.3.2",
    "linter-eslint: 8.5.5",
    "linter-jsonlint: 1.4.0",
    "linter-pylint: 2.1.1",
    "linter-sass-lint: 1.9.0",
    "linter-stylelint: 4.5.1",
    "linter-write-good: 0.9.3",
    "minimap-split-diff: 0.3.7",
    "modular-snippets: 0.1.3",
    "npm-outdated: 0.6.0",
    "pane-browser: 1.6.0",
    "pigments: 0.40.6",
    "plantuml-viewer: 0.7.2",
    "regex-railroad-diagram: 0.19.4",
    "relative-numbers: 0.9.1",
    "remember-folds: 0.3.0",
    "split-diff: 1.6.1",
    "teletype: 0.13.4",
    "terminal-tab: 0.6.0",
    "todo-show: 2.3.2",
    "tree-ignore: 0.6.2",
    "vim-mode-plus: 1.36.4",
    "vim-mode-plus-keymaps-for-surround: 0.2.1",
    "language-graphql: 1.0.0",
    "language-plantuml: 0.2.0",
    "language-markdown: 0.37.0",
    "language-github-actions: 0.1.0",
    "language-fish-shell: 1.1.0",
    "language-haml: 0.32.1",
    "language-ini: 1.23.0",
    "language-haskell: 1.21.0",
    "language-liquid: 0.7.0",
    "language-mermaid: 0.6.0",
    "language-nunjucks: 4.2.1",
    "language-patch: 1.2.0",
    "language-confluence-wiki: 0.2.0",
    "language-vue: 0.26.0",
    "react: 0.18.0",
    "atom-beautify: 0.33.4",
    "atom-ide-base: 2.3.2",
    "atom-ide-datatip: 0.23.2",
    "atom-ide-definitions: 0.4.1",
    "atom-ide-hyperclick: 1.0.9",
    "atom-ide-markdown-service: 2.0.0",
    "atom-ide-outline: 1.17.0",
    "atom-ide-signature-help: 0.15.1",
    "linter: 3.3.0",
    "linter-ui-default: 3.2.3",
    "minimap: 4.39.7",
    "minimap-find-and-replace: 5.0.8",
    "minimap-git-diff: 4.3.6",
    "minimap-linter: 2.2.2"
  ]
}

Moved from TypeStrong/atom-typescript#1573

Type parameters on JSX open tag identifiers cause the JSX block to be highlighted incorrectly

Edit by @rsese to add code from #34 (comment) and link to Apollo example code

export const TaskListItem = ({ id, children }: taskListItemProps) => (
  <Query<taskListItem, taskListItemVariables>
    query={TASK_LIST_ITEM}
    variables={{ id }}
  >
    {(queryProps) => {
      const { loading, data } = queryProps

      if (!loading && data && data.task) {
        return (
          <Mutations task={data.task}>
            {(mutations) => {
              return children({ ...queryProps, mutations })
            }}
          </Mutations>
        )
      } else {
        return children({ ...queryProps, mutations: undefined })
      }
    }}
  </Query>
)

Apollo code example: https://github.com/apollographql/react-apollo/blob/master/examples/typescript/src/Character.tsx


Prerequisites

Description

when adding aliases (?) to a component the rest of the JSX does not render correctly

for example, in the following code

  <Query<taskListItem, taskListItemVariables>
    query={TASK_LIST_ITEM}
    variables={{ id }}
  >
    {(queryProps) => (
      <Mutations id={id}>
        {(mutations) => {
          const finalProps = { ...queryProps, mutations }
          return children(finalProps)
        }}
      </Mutations>
    )}
  </Query>

the <taskListItem, taskListItemVariables> causes the entire jsx block to be rendered incorrectly.

inspecting it looks like the scope goes from:

source.tsx
meta.var.expr.tsx
meta.tag.tsx
entity.name.tag.tsx
support.class.component.tsx

to

source.tsx
meta.var.expr.tsx
variable.other.readwrite.tsx

Versions

Atom: 1.34.0
language-typescript: 0.4.11

Code folding in typescript files

Prerequisites

Description

In typescript files code folding seems to be buggy when a foldable block is preceded by comments. Specifically it will fold the comment line, and hide the next line down from that regardless of what that line is. Also it will not permit any line directly below a comment line to be folded.

This does not occur for regular javascript files so I hope this is the appropriate project to log this bug on. If not please let me know and I'll close this issue in favor of one on the correct repo.

Steps to Reproduce

  1. Open a new file and set the file type to Typescript
  2. Create a function with a comment line above it. I used
// test
test() {
  ...
}

/* 
  test
*/
test() {
  ...
}

// test1
// test2
// test3
test() {
  
}

Expected behavior:

  1. Foldable lines should be: 2, 6, 9, 13, 16
  2. Folding 13 should hide 14, 15

Actual behavior:

  1. Foldable lines are: 1, 6, 9, 13
  2. Folding 1 should not hide 2
  3. Folding 13 hides 14, 15, 16

Reproduces how often: Always, even in safe mode.

Versions

Electron: 1.6.15
Chrome  : 56.0.2924.87
Node    : 7.4.0
macOs High Sierra
Version 10.13.1

Additional Information

Unfolded, showing foldable lines
Unfolded, showing foldable lines
Folded
Folded

JSX Fragments Not Supported

Prerequisites

Description

JSX Fragments are not supported.

Steps to Reproduce

  1. Open a new file and set file type to TypeScriptReact
  2. Input code const fragment = <></>

Expected behavior:

Syntax should be supported and shouldn't show as invalid characters.

What Babel ES6 JavaScript does:

screen shot 2018-03-21 at 1 52 41 pm

Actual behavior:

Syntax is not supported and shows as invalid.

What TypeScriptReact does:

screen shot 2018-03-21 at 1 52 15 pm

Reproduces how often: Always.

Versions

Atom : 1.25.0
Electron: 1.7.11
Chrome : 58.0.3029.110
Node : 7.9.0
apm 1.19.0
npm 3.10.10
node 6.9.5 x64
atom 1.25.0
python 2.7.10
git 2.13.2
os OS X 10.12.2

Additional Information

JSX Fragments are currently supported in TypeScript 2.6. Closed issue microsoft/TypeScript#19094.

Failed to load a language-typescript package grammar

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.32.0 ia32
Electron: 2.0.9
OS: Microsoft Windows 8.1 Enterprise
Thrown From: language-typescript package 0.4.6

Stack Trace

Failed to load a language-typescript package grammar

At The specified module could not be found.
\\?\C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node in C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar\node_modules\language-typescript\grammars\tree-sitter-typescript.json

Error: The specified module could not be found.
\\?\C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:180:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:145671)
    at /app.asar/node_modules/tree-sitter-typescript/index.js:2:20)
    at /app.asar/node_modules/tree-sitter-typescript/index.js:11:3)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:146381)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:149928)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (internal/module.js:11:18)
    at customRequire (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:1:622321)
    at new TreeSitterGrammar (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:2952432)
    at GrammarRegistry.createGrammar (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:356290)
    at l.readFile (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:356131)
    at u (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:575466)
    at ~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:576719
    at ELECTRON_ASAR.js:530:9
    at FSReqWrap.wrapper [as oncomplete] (fs.js:658:17)
  at /app.asar/node_modules/language-typescript/grammars/tree-sitter-typescript.json:1:1

Commands

Non-Core Packages


.ts files are not auto detected

Prerequisites

Description

.ts files are not detected automatically because the .ts file types are not defined in the packages. Thus code is not highlighted until I configure the file as a TypeScript file.

Снимок экрана 2020-02-09 в 18 54 50

Versions

Atom 1.43.0
language-typescript 0.6.0

syntax highlighting issues.

Prerequisites

Description

I've recently been forced to switch from language-babel to language-typescript due to my language-babel no longer working with atom-typescript for some reason. The biggest thing I've noticed since making the switch is that the syntax highlighting for this grammar seems far behind that I had in language-babel. Some of the things I've seen so far:

  1. upper and lowercase variable names are styled differently:
Babel Typescript
babel typescript
  1. Same for variables inline:
Babel Typescript
babel typescript
  1. Types don't have the same level of detail so its impossible to style them much differently:
Babel Typescript
babel typescript

At first I thought this was an issue with my syntax theme, but on inspecting the CSS I found that most of these issues are due to the text not being tagged at all thus it is impossible to style things correctly.

For example the following is from babel:

<span class="syntax--variable syntax--other syntax--readwrite syntax--js">iconColor</span>

where as in typescript I get:

iconColor

no wrapper at all.

Multiline arguments types invalid highlight

Prerequisites

Description

Multiline arguments types highlited as variables in arrow functions

Steps to Reproduce

Type an arrow function with typed multiline arguments.

Expected behavior: Correct highlight

Actual behavior:
Sample

Reproduces how often: 100%

Versions

Atom : 1.34.0
Electron: 3.1.3
Chrome : 66.0.3359.181
Node : 10.2.0

Type generics for React components break syntax highlighting

Prerequisites

Steps to Reproduce

Enter this text and set the type to "TypeScriptReact":

// Add all the single-select stories first.
ALL_OPTIONS.forEach(({ name, options, stateKey }) => {
  storiesOf('Select', module).add(`Single value - ${name}`, () => (
    <State store={store}>
      {(state: PlainObject<string | string[]>) => (
        <Select<unknown>
          className='select-story-component'
        />
      )}
    </State>
  ));
});

// Add all the multi-select stories next.
ALL_OPTIONS.forEach(({ name, options, stateKey }) => {
  storiesOf('Select', module).add(`Multiple values - ${name}`, () => (
    <State store={store}>
      {(state: PlainObject<string | string[]>) => (
        <Select<unknown>
          className='select-story-component'
        />
      )}
    </State>
  ));
});

Actual behavior:

image

Reproduces how often:

100%

Versions

$ atom --version

Atom    : 1.45.0
Electron: 4.2.7
Chrome  : 69.0.3497.128
Node    : 10.11.0

Failed to load a language-typescript package grammar

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.47.0 x64
Electron: 5.0.13
OS: Microsoft Windows 10 Home
Thrown From: language-typescript package 0.6.2

Stack Trace

Failed to load a language-typescript package grammar

At The specified module could not be found.
\\?\C:\Users\Yongbum\AppData\Local\atom\app-1.47.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node in C:\Users\Yongbum\AppData\Local\atom\app-1.47.0\resources\app.asar\node_modules\language-typescript\grammars\tree-sitter-typescript.json

Error: The specified module could not be found.
\\?\C:\Users\Yongbum\AppData\Local\atom\app-1.47.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:881:18)
    at Object.func [as .node] (electron/js2c/asar.js:147:18)
    at Module.load (internal/modules/cjs/loader.js:701:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
    at Function.Module._load (internal/modules/cjs/loader.js:625:3)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:146766)
    at /app.asar/node_modules/tree-sitter-typescript/typescript/index.js:2:20)
    at /app.asar/node_modules/tree-sitter-typescript/typescript/index.js:15:3)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:147450)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:150998)
    at Module.load (internal/modules/cjs/loader.js:701:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
    at Function.Module._load (internal/modules/cjs/loader.js:625:3)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (internal/modules/cjs/helpers.js:14:16)
    at customRequire (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:1:735013)
    at new TreeSitterGrammar (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:3220847)
    at GrammarRegistry.createGrammar (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:360231)
    at ~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:360072
    at u (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:580740)
    at ~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:581993
    at electron/js2c/asar.js:571:9
    at FSReqCallback.wrapper [as oncomplete] (fs.js:483:5)
  at /app.asar/node_modules/language-typescript/grammars/tree-sitter-typescript.json:1:1

Commands

Non-Core Packages

atom-beautify 0.33.4 
autoclose-html 0.23.0 
autocomplete-python 1.16.0 
code-peek 1.4.21 
color-picker 2.3.0 
emmet 2.4.3 
highlight-selected 0.17.0 
kite 0.184.0 
script 3.25.0 

Grammar generator mishandles function arguments that span multiple lines

Prerequisites

Description

If you create a typescript function with arguments on separate lines, they don't get the proper scopes associated with them and end up not getting highlighted correctly by the syntax theme.

Here's an example function that is highlighted correctly (because all of the args on the same line):
image

Here's an example of that same function but highlighted incorrectly (because of the args on different lines):
image

In looking at scopes, I see that the html created for the one-liner function declaration's first argument looks like:

<span class="syntax--variable syntax--parameter syntax--ts">arg1</span>
<span class="syntax--meta syntax--type syntax--annotation syntax--ts">
  <span class="syntax--keyword syntax--operator syntax--type syntax--annotation syntax--ts">:</span> 
  <span class="syntax--support syntax--type syntax--primitive syntax--ts">number</span>
</span>

and the first argument for the multi-line arguments looks like:

<span class="syntax--meta syntax--var syntax--expr syntax--ts">
  <span class="leading-whitespace">  </span>
  <span class="syntax--variable syntax--other syntax--readwrite syntax--ts">arg1</span>: 
  <span class="syntax--variable syntax--other syntax--readwrite syntax--ts">number</span>
  <span class="syntax--punctuation syntax--separator syntax--comma syntax--ts">,</span>
</span>

Which is clearly wrong.

Steps to Reproduce

  1. Create new typescript file with a function declaration, where the arguments are on separate lines (as seen above).
  2. Check if types are highlighted (or if you want to be thorough, compare scopes with a single line function).

Expected behavior: Arguments for a function that spans multiple lines should get the right scopes

Actual behavior: Arguments for a function that spans multiple lines are getting variable scopes instead of parameter scopes.

Reproduces how often: 💯

Versions

Atom: 1.27.1
Apm: 1.19.0
OS: Windows 10

Variables that start with capital letter marked as types

Prerequisites

Description

Variables that start with capital letter marked as types

Steps to Reproduce

  1. Write
const bar = 'bar';
const Foo = 'foo';
  1. Open DevTools
  2. See that Foo has class syntax--type and is highlighted as a type

Expected behavior:

A variable is highlighted as a variable and not a type.

Actual behavior:

A variable is highlighted as a type.

Reproduces how often:

Always.

Versions

$ atom --version
Atom    : 1.38.2
Electron: 4.1.4
Chrome  : 69.0.3497.128
Node    : 10.11.0

$ apm --version 
apm  2.3.1
npm  6.9.0
node 11.15.0 x64
atom 1.38.2
python 2.7.16
git 2.22.0

Additional Information

Why

Failed to load a language-typescript package grammar

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.22.1 x64
Electron: 1.6.15
OS: Mac OS X 10.13.1
Thrown From: language-typescript package 0.3.0-1

Stack Trace

Failed to load a language-typescript package grammar

At Grammar missing required scopeName property: /Users/sunxingchen/.atom/packages/language-typescript/grammars/tree-sitter-flow.cson in /Users/sunxingchen/.atom/packages/language-typescript/grammars/tree-sitter-flow.cson

Error: Grammar missing required scopeName property: /Users/sunxingchen/.atom/packages/language-typescript/grammars/tree-sitter-flow.cson
    at /Applications/Atom.app/Contents/Resources/app/node_modules/first-mate/lib/grammar-registry.js:123:70
    at /Applications/Atom.app/Contents/Resources/app/node_modules/season/lib/cson.js:223:65
    at tryToString (fs.js:426:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:413:12)
  at /packages/language-typescript/grammars/tree-sitter-flow.cson:1:1

Commands

Non-Core Packages

advanced-open-file 0.16.7 
atom-beautify 0.30.9 
atom-clock 0.1.15 
atom-html-preview 0.2.5 
atom-ternjs 0.18.3 
atom-typescript 11.0.10 
audio 1.5.7 
auto-detect-indentation 1.3.0 
busy-signal 1.4.3 
coffee-navigator 0.0.18 
cson 2.0.1 
ex-mode 0.18.0 
git-control 0.9.0 
gitignore-snippets 0.2.5 
gitignores 0.3.2 
goto-definition 1.3.4 
graphviz-preview-plus 1.5.2 
highlight-selected 0.13.1 
intentions 1.1.5 
javascript-snippets 1.2.1 
javascript-standard-snippets 0.2.1 
language-dot 1.7.0 
language-gitignore 0.3.0 
language-kagex 0.2.4 
language-lisp 0.2.0 
language-matlab 0.2.1 
language-tjs 0.6.2 
linter 2.2.0 
linter-coffeelint 1.3.1 
linter-coffees6 2.0.0 
linter-js-standard 4.1.0 
linter-markdown 5.2.0 
linter-sass-lint 1.8.3 
linter-ui-default 1.6.10 
linter-xmllint 1.4.3 
markdown-pdf 2.1.0 
markdown-preview-plus 2.4.16 
minimap 4.29.7 
minimap-cursorline 0.2.0 
minimap-find-and-replace 4.5.2 
minimap-git-diff 4.3.1 
minimap-highlight-selected 4.6.1 
minimap-selection 4.5.0 
pdf-view 0.61.0 
sequential-number 0.5.0 
simplified-chinese-menu 5.3.5 
sync-settings 0.8.3 
tab-numbers 0.6.1 
tree-view-copy-relative-path 1.2.0 
videoplayer 1.2.1 
vim-mode-plus 1.16.0 

TypeScript `export =` syntax not highlighted with inline declarations

Prerequisites

Description

The export = syntax isn't highlighted

Steps to Reproduce

  1. Create a new TypeScript file
  2. export an inline declaration (an object, a function, a string, etc.) (e.g. export = new Array();)
  3. move that inline assignment to a variable, and export that variable
  4. Note difference in scopes and highlighting

Expected behavior: For the export = to always be highlighted using the proper scopes

Actual behavior: No scopes are added thus the highlighting never happens

Edit by @rsese to add screenshot

export-scope

Reproduces how often: 100%

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

$ atom --version
Atom    : 1.35.0-nightly1
Electron: 2.0.14
Chrome  : 61.0.3163.100
Node    : 8.9.3
$ apm --version
apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.35.0-nightly1
python 2.7.15
git 2.19.2.windows.1
visual studio 2015

Additional Information

When a variable is exported using this syntax, it gets the scope syntax--keyword syntax--control

NoSubstitutionTemplateLiteral breaks coloring

Prerequisites

Description

When using NoSubstitutionTemplateLiterals as types it breaks coloring.

Steps to Reproduce

type literal = {
	normal: "string"
	hello: `hello`
	world: `world`
	exclamation: `!`
	another: `!`
}

Expected behavior: [What you expect to happen]

Text is colored correctly.

Actual behavior: [What actually happens]

Screen Shot 2019-04-03 at 10 42 06 AM

Edit by @rsese to add additional screenshot with 1.37.0-nightly32 on macOS 10.12.6:

hello-value

And with Tree-sitter disabled:

hello-value-ts-disabled

Reproduces how often: [What percentage of the time does it reproduce?]

Always.

Versions

electron 2.0.18
chrome 61.0.3163.100
apm 2.1.3
npm 6.2.0
node 8.9.3 x64
atom 1.35.1
python 2.7.16
git 2.20.1
language-typescript 0.4.11
macos 10.14.4

It's broken. fIx it

Prerequisites

Description

[Description of the issue]

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Flow files no longer have `source.js` scope, snippets broken

Prerequisites

Description

Moved from atom/atom#18398.

When using the flow pragma in a file, all of my existing javascript snippets no longer work. I notice that the scope in these files no loner include source.js, which is what my snippets are expecting. Do I now need to duplicate all my snippets for both scopes, so I can work in files with and without flow? Do I need to recreate "built-in" snippets like log?

Steps to Reproduce

  1. Add // @flow to the top of a file
  2. Save the file, close, and reopen
  3. Notice that you can no longer type log and tab, and get console.log();

Expected behavior: [What you expect to happen]

Javascript snippets work in flow files.

Actual behavior: [What actually happens]

They don't.

Reproduces how often: [What percentage of the time does it reproduce?]

100%

Versions

Atom    : 1.33.0-beta1
Electron: 2.0.11
Chrome  : 61.0.3163.100
Node    : 8.9.3
apm  2.1.2
npm  6.2.0
node 8.9.3 x64
atom 1.33.0-beta1
python 2.7.10
git 2.19.1

Additional Information

With tree-sitter enabled, module imports no longer have syntax--import css class

Prerequisites

Description

When you enable tree-sitter parser, an import statement in a typescript file no longer has a css class "syntax--import." In atom/solarized-dark-syntax and atom/solarized-light-syntax, we theme the import line differently. If the "syntax--import" class is no longer there, we're unable to theme those lines as before.

Steps to Reproduce

  1. Enable tree-sitter parser
  2. Inspect typescript file that has a line such as import * as React from "react";

Expected behavior: Some indication that import, as, and from are "import" keywords.

Actual behavior: No indication that they are "import" related.

Reproduces how often: 100%

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Template literals

Summary

In languages such as Ruby or CoffeeScript, Atom has a feature to quickly change a selection inside a string into a template literal. Since template literals are supported in TypeScript, it would be nice to have the same feature for the language.

Steps:

  1. Select any part inside a string (enclosed in backticks), e.g. name
  2. Press $ key
  3. Selection becomes ${name}

Motivation

Existing feature in Ruby, CoffeeScript and possible other bundled Atom syntax languages.

Additional context

Here's an animation showcasing the feature when working in CoffeeScript

cs

Failed to load a language-typescript package grammar

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.47.0 x64
Electron: 5.0.13
OS: Unknown Windows version
Thrown From: language-typescript package 0.6.2

Stack Trace

Failed to load a language-typescript package grammar

At The specified module could not be found.
\\?\C:\Users\yesol\AppData\Local\atom\app-1.47.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_tsx_binding.node in C:\Users\yesol\AppData\Local\atom\app-1.47.0\resources\app.asar\node_modules\language-typescript\grammars\tree-sitter-flow.json

Error: The specified module could not be found.
\\?\C:\Users\yesol\AppData\Local\atom\app-1.47.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_tsx_binding.node
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:881:18)
    at Object.func [as .node] (electron/js2c/asar.js:147:18)
    at Module.load (internal/modules/cjs/loader.js:701:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
    at Function.Module._load (internal/modules/cjs/loader.js:625:3)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:146766)
    at /app.asar/node_modules/tree-sitter-typescript/tsx/index.js:2:20)
    at /app.asar/node_modules/tree-sitter-typescript/tsx/index.js:15:3)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:147450)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:150998)
    at Module.load (internal/modules/cjs/loader.js:701:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
    at Function.Module._load (internal/modules/cjs/loader.js:625:3)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (internal/modules/cjs/helpers.js:14:16)
    at customRequire (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:1:735013)
    at new TreeSitterGrammar (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:3220847)
    at GrammarRegistry.createGrammar (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:360231)
    at ~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:360072
    at u (~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:580740)
    at ~/AppData/Local/atom/app-1.47.0/resources/app/static/<embedded>:11:581993
    at electron/js2c/asar.js:571:9
    at FSReqCallback.wrapper [as oncomplete] (fs.js:483:5)
  at /app.asar/node_modules/language-typescript/grammars/tree-sitter-flow.json:1:1

Commands

     -1:11.4.0 markdown-preview-enhanced:toggle (input.hidden-input)

Non-Core Packages

markdown-preview-enhanced 0.17.8 
seti-icons 1.5.4 

No syntax highlighting at all

Prerequisites

Description

Steps to Reproduce

  1. download atom in https://atom.io/
  2. download atom-typescript package in https://atom.io/packages/atom-typescript
  3. check if language-typescript in Core Packages is installed/enabled

Expected behavior:

TypeScript files should have syntax highlighting.

Actual behavior:

No syntax highlighting in *.ts files.

Versions

v1.43.0

Additional Information

Syntax highlighting works perfectly fine on other file types. I already checked .html, .json, .scss, .json and even in other file types. Only typescript files have no syntax highlighting.

I already tried downloading and checking if maybe the syntax highlighting works in Beta and Nightly version but still no syntax highlighting at all.

Grammar generator mishandles name property with embedded scopes

Prerequisites

Description

Grammar generator mis-handles name property with embedded scopes, for example:

"name": "meta.definition.function.ts entity.name.function.ts"

FirstMate can't handle this syntax, and as a result, source span gets the class syntax--meta syntax--definition syntax--function syntax--ts entity syntax--name syntax--function syntax--ts. Notice the naked entity without synax-- prefix there in the middle.

This is brought over from TypeStrong/atom-typescript#1379

Steps to Reproduce

  1. Create TypeScript file with contents
    class SomeClass {
      someMethod() {}
    }
  2. log-cursor-scope on someMethod

Expected behavior:

  • source.ts
  • meta.class.ts
  • meta.method.declaration.ts
  • meta.definition.method.ts
  • entity.name.function.ts

Actual behavior:

  • source.ts
  • meta.class.ts
  • meta.method.declaration.ts
  • meta.definition.method.ts entity.name.function.ts

Reproduces how often: 100%

Versions

[:~] $ atom --version
Atom    : 1.23.1
Electron: 1.6.15
Chrome  : 56.0.2924.87
Node    : 7.4.0
[:~] $ apm --version
apm  1.18.11
npm  3.10.10
node 6.9.5 x64
atom 1.23.1
python 3.4.6
git 2.15.1

Additional Information

See also: microsoft/TypeScript-TmLanguage#545

Incorrect indentation when using flow and tree-sitter

Prerequisites

Description

I originally opened this in atom/language-javascript#603. Duplicating here, since this seems to be the grammar being used.

When using the Flow Javascript grammar with tree-sitter enabled, I notice that parenthesis are not always outdented correctly, whereas they are when using Javascript. Here are some examples (taken during safe mode):

Javascript (correct)

javascript

Flow Javascript (incorrect)

flow

Steps to Reproduce

  1. Create a file with the flow pragma
  2. Verify the grammar shows as Flow Javascript
  3. Notice that indentation is wonky, as shown in the gif above.

Expected behavior: [What you expect to happen]
I expect the closing parenthesis to be on the same column as the first character of the line with the opening parenthesis.

Actual behavior: [What actually happens]
The closing parens is indented by one level, to the same position as the cursor.

Reproduces how often: [What percentage of the time does it reproduce?]
100%

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

Atom : 1.32.0-beta3
Electron: 2.0.9
Chrome : 61.0.3163.100
Node : 8.9.3
apm 2.1.2
npm 6.2.0
node 8.9.3 x64
atom 1.32.0-beta3
python 2.7.10
git 2.19.1

Failed to load a language-typescript package grammar

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.32.0 ia32
Electron: 2.0.9
OS: Microsoft Windows 8.1 Enterprise
Thrown From: language-typescript package 0.4.6

Stack Trace

Failed to load a language-typescript package grammar

At The specified module could not be found.
\\?\C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node in C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar\node_modules\language-typescript\grammars\tree-sitter-typescript.json

Error: The specified module could not be found.
\\?\C:\Users\SADEGHAZAMI1981GMAIL\AppData\Local\atom\app-1.32.0\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:180:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:145671)
    at /app.asar/node_modules/tree-sitter-typescript/index.js:2:20)
    at /app.asar/node_modules/tree-sitter-typescript/index.js:11:3)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:146381)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:149928)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (internal/module.js:11:18)
    at customRequire (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:1:622321)
    at new TreeSitterGrammar (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:2952432)
    at GrammarRegistry.createGrammar (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:356290)
    at l.readFile (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:356131)
    at u (~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:575466)
    at ~/AppData/Local/atom/app-1.32.0/resources/app/static/<embedded>:11:576719
    at ELECTRON_ASAR.js:530:9
    at FSReqWrap.wrapper [as oncomplete] (fs.js:658:17)
  at /app.asar/node_modules/language-typescript/grammars/tree-sitter-typescript.json:1:1

Commands

Non-Core Packages


Support for "abstract" keyword

Summary

Currently, the TypeScript language detection does not recognize the "abstract" keyword as a keyword, so the proper syntax highlighting cannot be applied.

Motivation

"abstract" is part of the language for declaring abstract classes.

Describe alternatives you've considered

N/A

Additional context

image

<unknown> is deprecated.

You have the core package "language-typescript" installed as a community package. See https://github.com/atom/dalek for how this causes problems and instructions on how to correct the situation.

<unknown> (<embedded>:13596:20)
Generator.next (null:null:null)
step (<embedded>:13583:279)
<unknown> (null:null:null)
process._tickCallback (internal/process/next_tick.js:109:7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.