如何为自定义库启用智能感知?

时间:2017-05-23 11:33:21

标签: javascript visual-studio-code

我有一个简单的节点自定义库,让我们假设:

Option Explicit
Dim rCell As Range

Private Sub CommandButton1_Click()
rCell.Cells(ListBox1.ListIndex + 1).Value = TextBox1.Value
Refresh_Values
End Sub

Private Sub ListBox1_Click()
  With ListBox1
    TextBox1.Value = .List(.ListIndex)
  End With
End Sub

Private Sub UserForm_Initialize()
Refresh_Values
End Sub

Sub Refresh_Values()
Dim a() As Variant
  Set rCell = Sheet1.Range("A1:A7")
  a() = rCell.Value
  ListBox1.List() = a()
End Sub

grunt任务后,我最终得到一个var extend = require('extend'); var jQuery = require("jquery"); import Logger from './../modules/logger.js'; import Cookie from './../modules/cookie.js'; import DOM from './../modules/dom.js'; export default class MyScript { constructor(document, active) { this.document = document; this.active = active; this.$ = jQuery; } /* utilities */ /** * Tries to convert a string into a number, returns default number if string can't be converted * @param {string} str The string to be converted * @param {number} defaultValue The default number * @returns number */ tryParseInt(str, defaultValue) { var retValue = defaultValue; if (str !== null) { if (str.length > 0) { if (!isNaN(+str)) { retValue = parseInt(str, 10); } } } return retValue; } /** * generates a random string * @param {number} length the length of the string to generate * @param {string} chars the generated string type * @returns string */ generateRandomId(length, chars) { // http://stackoverflow.com/a/10727155/28004 var mask = ''; if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz'; if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; if (chars.indexOf('#') > -1) mask += '0123456789'; if (chars.indexOf('!') > -1) mask += '~`!@#$%^&*()_+-={}[]:";\'<>?,./|\\'; var result = ''; for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)]; return result; } } 文件,其开头为:

.js

我在我的HTML代码中正常使用它:

var MyCustomScript = 
/******/ (function(modules) { // webpackBootstrap
/******/    // The module cache
/******/    var installedModules = {};

/******/    // The require function
/******/    function __webpack_require__(moduleId) {

/******/        // Check if module is in cache
/******/        if(installedModules[moduleId])
/******/            return installedModules[moduleId].exports;

/******/        // Create a new module (and put it into the cache)
/******/        var module = installedModules[moduleId] = {
/******/            exports: {},
/******/            id: moduleId,
/******/            loaded: false
/******/        };
...

一切正常...... 问题,当我在{{1}后按<script src="/dist/myscript.js"></script> <script> var my = new MyCustomScript(document, true), password = my.generateRandomId(8, "Aa"); my.$("#password").text(password); </script> 时,我希望在VSCode(或Atom)中进行智能化处理} ...

我试图添加

.

位于HTML的顶部,但没有运气......正确的方法是什么?

0 个答案:

没有答案